Examples of report expressions for repeat sections are provided below.
To access questions in a repeat, add a repeat section to your template. For a repeat named defects, the ${#defects} placeholder denotes the start of the repeat section, and ${/} denotes the end. Placeholders pointing to questions in the repeat must be between the repeat section's start and end placeholders.
Note:
To print the contents of a repeat in a table, ensure that both the starting tag and the ending tag are placed inside the table or outside the table. A report can't be generated if one of these tags is inside a table and the other is outside it. In general, if a start tag and an end tag are placed inside a table, the start tag should be in the first cell and the end tag should be in the last cell.
To access questions in a nested repeat, place its tags between the tags for each repeat layer above the intended repeat section. The following is an example:
${#repeat1}
${#repeat2}
${#repeat3}
${field1InRepeat3}, ${repeat2.field1}, ${repeat1.field1}, ${mainLayer.field1}
${/}
${/}
${/}
Report expressions cannot read special characters, such as hyphens, when referencing layer names using the ${layername} syntax. When referencing a layer that contains a special character in its name, use an underscore in place of the special character. Alternatively, you can refer to the layer using the $layers keyword and either the layer name or layer ID, for example, ${$layers["my layer name"]} or ${$layers[0]}. This can be useful when the layer name contains non-ASCII characters or duplicate layer names exist in the feature service.
To reference a field in the repeat that has the same name as its parent repeat, use the full path syntax including both field name and repeat name, for example, ${sharedName.sharedName}.
To display the index of a repeat record, use the getValue expression with the reserved keyword $feature. The following example produces 1 for the first record in a repeat, 2 for the second, and so on:
${#defects}
${$feature | getValue: "position"}
${/}