Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to use instanceManager.count to identify first and last row of a repeatable subform

Avatar

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct Reply

0 solutions
View profile
dv27
Level 2

20-12-2011

How can I identify the first and last row in a repeatable subform? I’m using instanceManager and managed to calculate the total number of rows using FormCalc, however, I don’t know how to identify the first and last row.

This is what I need to do:

The repeatable subform contains a checkbox. If this checkbox is checked in the first and/or last row (of the repeatable subform), then I need a calculation to be performed, otherwise, this calculation should not occur.

Thanks for your help!

Replies

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct Reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct Reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

23-12-2011

Hi,

the first row always has the instance number 0, such as "Table1.Row1[0]" or simply "Table1.Row1".

The last row can be addressed by instance counter "Table1.Row1[Table1.Row1.instanceManager.count - 1]" or the short way "Table1.Row1[Table1._Row1.count - 1]".

Avatar

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
dv27
Level 2

Likes

0 likes

Total Posts

10 posts

Correct Reply

0 solutions
View profile
dv27
Level 2

16-01-2012

hello there! thank you so much!!!! However, I’m trying to apply this same code to a second object that is performing an additional calculation and I’m having A LOT of trouble and would LOVE your help or anyone else's help.

My calculations are dependent on:
1.      If a checkbox is checked
2.      The number of days entered
3.      The number of rows that are added

Basically, if the first row is the ONLY row, then it can contain three possible calculations

  1. if a checkbox is checked and the total number of days entered is <= 2, then the calculation is.... partial.rawValue  * Days.rawValue
  2. if a checkbox is checked and the total number of days entered is > 2, then the calculation is....perDiem.rawValue * (Days.rawValue - 2 ) + (partial.rawValue * 2)
  3. otherwise, the calcuation is....perDiem.rawValue * Days.rawValue

    However, if more than one row is selected, then the first and the last row would contain the following possible calculations:

    1. If a checkbox is checked, then the calculation is…perDiem.rawValue * (Days.rawValue - 1 ) + partial.rawValue
    2. Otherwise, the calculation is…perDiem.rawValue * Days.rawValue

      The middle rows are always going to contain one possible calculation of…perDiem.rawValue * Days.rawValue