I have a requirement to include several repeating blocks (one per page) in a Maestro form. If one of the blocks has a row added, all the others should have one added. If row 2 is deleted in one of the blocks, then row 2 in the other blocks should be deleted.
Example use cases for this are things like co-signers, dependents, additional applicants. This way you can add/remove an additional applicant by adding a few extra fields to the bottom of each page, rather than adding additional pages (i.e. add the "About You" fields for the co-applicant under then same fields for the primary).
Can this be achieved and if so what is the best approach?
The best approach is to decide on one "master" repeat and then set a calculation rule on the other "mirror" repeats to be equal to the master repeat. It doesn't really matter which one you pick as your "master", but usually you have an obvious candidate, the place where instances are added and removed. All the other ones will have this repeat count mirrored. They can use field values directly from the original repeat, (either directly or in derived calculations) or add completely new fields - and all of these field values will be available to all other instances which are calculated from the same repeat. Essentially, they all become data-driven from a single array of repeat instances.
This is much more stable and reliable than trying to keep two or more separate data arrays in sync by adding and removing items programmatically. And it's such a common paradigm that we need to ensure we have some good training / documentation / sample content collateral in place to show examples in practice.
I'll forward this to the training and documentation gurus to see how we best get this covered off.
Thanks Tim, if an example script or KB article becomes available that would be great
Can you briefly touch on this statement:
"They can use field values directly from the original repeat, (either directly or in derived calculations)"
I have a form using a (nested) repeat structure as a model, and I want to use existing values in two mirrored repeats as labels, but because field naming is unique they won't align, and simply referencing the model fields in the mirrored text display labels or text field calc script doesn't seem to be working for me.
First of all I'am using Maestro. I have similar situation here. On first page I've got one repeating block with dropdown list and few fields. On next two page I've got two other repeating blocks one per page. First of them is for business value from dropdown and the second is for private both should "mirroring" values from 'master' depends of choice made in dropdown list in master repeating block.I found out method's in API Methods:
Util.getRepeatDataArray(Form.getItemFromPath('Form.data.content1.firstName')) - I understand this method take field from each item and put it into array, am I right? Or perhaps there is possibility to get whole content from items? It's working for me fine when I'm getting array of one field in added items. And there is another method in API Methods
Util.addRepeatContent(repeatItem, dataArray) - but it's not working at all. I would like to ask to wider explenation about how to use this method especially what is expected as a repeatItem (single field, whole item) and how should dataArray looks like ?
Can you be so kind and provide some good example?
My code of using this two methods:
var fName = Util.getRepeatDataArray(Form.getItemFromPath('Form.data.content1.firstName')) //array of value from repeating block
repeatItem = Form.getItemFromPath('data.content2') //content of repeating block which I would like to fill
Util.addRepeatContent(repeatItem, fName) //Not working :(