Injecting object index in Document Generation API {% repeating-section %} tag
Hi folks,
I'm trying something slightly advanced with the Document Generation API JSONata syntax by trying to inject an object's index into the object itself.
I've reviewed the JSONata processing model and understand that it's possible to get an object's position in the array using the `#$var` syntax as described here: https://docs.jsonata.org/processing. The JSONata documentation also shows an example of this syntax here: https://docs.jsonata.org/path-operators#-positional-variable-binding
Given the following JSON:
{
"winners": [
{
"firstName": "Bob",
"lastName": "Ross"
},
{
"firstName": "John",
"lastName": "Doe"
}
]
}I would like to use a Document Generation tag like the following:
{% repeating-section winners#$i.{'firstName': firstName, 'lastName': lastName, 'position': $i} %}
• Race participant {{firstName}} {{lastName}} completed the race in position: {{position}}
{% end-section %}I've tried just about every combination of the syntax both in the repeatable content tags and in the `repeating-section` tag but I cannot get the array position to be injected. The `repeating-section` tag is simply omitted from the resulting document. Something interesting to note is that object property reassignment works perfectly well:
{% repeating-section winners.{'f': firstName, 'l': lastName} %}
• Race participant {{f}} {{l}} completed the race
{% end-section %}Has anyone successfully done this or is support for this syntax limited?
Cheers,
