Instance Count

Avatar

03-09-2008

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?

Replies

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

03-09-2008

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

03-09-2008

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

Avatar

pguerett

Avatar

pguerett

pguerett

03-09-2008

Absolutely ...

Avatar

Avatar

xrum

Avatar

xrum

xrum

03-09-2008

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

03-09-2008

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