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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Instance Count

Not applicable
I want to have a field visible to the user that indicates which instance of the subform they are looking at. For example, in my form adding an instance is in fact adding an item to a policy. If it is the first instance added I want the ITEM# field to show "1". When they click "add item" additional times I want the next ITEM# to be 2 while the first subform ITEM# remains 1. Pretty much I want to utilize the [*] instance count as a visible item count for the user. How do I do this?
6 Replies
pguerett
Level 10
Level 10
You can get the instance number on an object in the subform by using this.parent.index Remeber that instance numbers are 0 based.
Not applicable
Ok, I'll give that a try. I understand they are "0" based, couldn't I just add one to the return from this.parent.index to get an accurate number for my purposes?
xrum
Level 4
Level 4
you can set the rawdata of the "count field" to



xfa.form.form1.formPage.mainSub.table.instanceManager.count



which will give you the current row #.



hope this helps
Not applicable
Hi,

Paul's answer is correct. You can use parent's index property. instanceManager.count will give the latest count of instances of row. But wont show the instance index of current row.

So this.parent.index + 1 is the solution.



Asiye
Not applicable
this.parent.index +1 is working perfectly! Thank you so much!