Typically I would use a textfield with the script "this.rawValue = SubformA.index + 1;" to track/count the number of instances of SubformA. So,if I have an Add button and a new verison of the subform is created, the textfield would read 2,3,4 etc.
Simple, but I need to place the script (this.rawValue = SubformA.index + 1;) in a Master page so i can use it in a header on every page. To do this, I used the full path to reference the Subform (this.rawValue = xfa.form.form1.SubfromA.index+1;) however every time a new version of the subform is created (by pressing the add button), it keeps the instance at 1. It no longer increases by 1 as it did when the script wasn't in the Master Page.
Any idea what's going on? How can I use .index+1 in the Master page and still have it increase by one easch time a Subfom (not in the Master page) is created?
Thanks in advance.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I would recommend using .count instead of index.
this.rawValue = page1._SubformA.count;
The underscore in front of the SubformA is shorthand for instanceManager.
If the form is likely to extend beyond one page, you should set the binding of the textfield to global in the Object > Binding palette.
Good luck,
Niall
Views
Replies
Total Likes
Hi,
I would recommend using .count instead of index.
this.rawValue = page1._SubformA.count;
The underscore in front of the SubformA is shorthand for instanceManager.
If the form is likely to extend beyond one page, you should set the binding of the textfield to global in the Object > Binding palette.
Good luck,
Niall
Views
Replies
Total Likes
Thanks Niall! I extended your recommendation and used:
this.rawValue = xfa.form.form1.RN._RnSet.count;
Works great!!!!
Views
Replies
Total Likes
Sorry, I thought this was answered. The script works; however, it's not increasing the subform index by 1. I have an "add button" in the form, so each time it's pressed, I'd like the textfield to show the incremental index number.
Thanks
Views
Replies
Total Likes
Hi,
The script in the calculate event of the textfield, will give you the total number of rows in the table (eg number of instances of the repeating object). This is on the basis that you have a single textfield, separate from the table.
If on the other hand you have the textfield in the table and you want to display the current index, then have a look at this solution: http://assure.ly/gBJYj9. Tables 4 and 5 are table objects, whereas Table 6 uses subforms. All of these have a textfield in the repeating object, which displays that row's index.
// calculate item number from index
this.rawValue = this.parent.index + 1;
Hope that helps,
Niall
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies