Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Instance Count

Avatar

Former Community Member
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

Avatar

Former Community Member
You can get the instance number on an object in the subform by using this.parent.index Remeber that instance numbers are 0 based.

Avatar

Former Community Member
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?

Avatar

Former Community Member
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

Avatar

Former Community Member
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

Avatar

Former Community Member
this.parent.index +1 is working perfectly! Thank you so much!