I have a field called ch7_subtotal that resides in an unnamed subform at the end of page 4 of a form. There are other unnamed subforms on the same page, and these subforms support recurring rows. On page 5 of the same form there's a field called grand_total that uses ch7_subtotal in a calculation. The grand_total field references ch7_subtotal like this:
xfa.resolveNode("fields.Page4.#subform[7].ch7_subtotal").rawValue
When I open the form in Acrobat and start entering data, this calculation works fine until I add a new row for (new instance of) one of the other subforms on page 4. Apparently this changes the index of #subform[7] (I guess it increments it to #subform[8]?), because I get this error on the grand_total field's calculate event:
"xfa.resolveNode("fields.Page4.#subform[7].ch7_subtotal") has no properties"
I "fixed" the problem by giving #subform[7] a name:
xfa.resolveNode("fields.Page4.mysub.ch7_subtotal").rawValue
However, I would really prefer to leave the subform unnamed (the data in the form is exported to XML, and I need this field to be named just ch7_subtotal, not something like "mysub.ch7_subtotal"). Is there a way to cycle through the subforms on a page, looking for the subform that contains a field call ch7_subtotal? Then I could use the index of that subform in resolveNode().
Thanks in advance for any suggestions!