I have a maintenance form where each item that gets inspected needs to have a unique number. The Item # is a Numeric Field and I have tried many different ways to count the Subform1 instances but nothing works 100% of the time. The issue is I can count the instances on initialize or I can add 1 to the index but it doesn't work if I need to remove sections. I need to find a way that correctly identifies the item number despite errors made by the user when they need to remove sections. I've also tried just have the item # be the page number but some inspections last more than one page so this is not a solution either.
Thanks for you help - I'm sure the answer is fairly simple (the form is built in javascript)
Solved! Go to Solution.
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi,
assumed you have a repeatable subform "SF" which contains a numeric field "Nmb".
You can update the instance count with a small script (FormCalc) in the indexChange event of your subform.
form1.#subform[0].SF::indexChange - (FormCalc, client)
Nmb = $.index + 1
Views
Replies
Total Likes
I think this issue there is that I'm using javascript not formcalc.
Views
Replies
Total Likes
This makes no big difference.
Nmb.rawValue = this.index + 1;
Views
Replies
Total Likes
It worked....I had to add a couple of parents in so it was this.parent.parent.index +1 just for other people wondering why it might not work. I put the script in the layout:ready event location.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies