Hi - what's the recommended way to get the number of instances in a repeat?
I have a form where they would like to hide the heading if there is only one instance, but show it if there is more than one. Would we just get the length of the array returned from Form.getRepeatData(...) ?
It is as simple as getting the length of the repeat array.
Ensure that the item data you are referencing is the repeat.
Thanks Dave, however that doesn't seem to be working for me:
I've created a sample form:
I've got a visibility rule on the Repeat Header Block inside the repeat. data.contentrpt is coming back as undefined so I can't get the length of it.
If I do:
from the console it's always returning 1, regardless of the number of instances. Could you please let me know what the code should be to get the repeat length from inside the repeat?
If you are within the repeat you need to jump up to the parents data object.
Please watch this video that explains how repeating data in Maestro works.
Cheers Dave, that worked. However when I double click a repeat from a visiblity rule for an element inside the repeat, it was referring to it as data.contentrpt, not data.$p.contentrpt. I'll raise a ticket?