1

In the image below I would like to keep the "Sub Section X" counter from resetting when a new "Master Section" (group 1) is inserted.

Nested repeating nodes

Ideally, the form will appear as such when the counting is being performed correctly:

Nested repeating nodes counting correctly

I have found that referencing a counter outside of the repeating group (say count(//group2)) and unchecking "refresh value when formula is recalculated" proves to be unreliable.

Here is the XPath for each node:

Group1Count: count(../preceding-sibling::*) + 1

Group1Label: concat("Master Section ", ../my:Group1Count)

Group2Count: count(../preceding-sibling::*) - 1

Group2Label: concat("Sub Section ", ../my:Group2Count)

1

Ok! I got it:

count(../my:Group2Count/preceding::*[contains(name(), "Group2Count")]) + 1

This filters all the preceding nodes for only those that contain the appropriate name and uses a relative path to identify the target node. This counts in the manner I specified above.

This tutorial was quite helpful! Still picking this up as I go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.