I am trying to create a report that displays each new repeat feature to a new page. I read some older posts that this is possible by adding index (=repeat count) to the survey. (Link: https://community.esri.com/t5/arcgis-survey123-questions/survey123-feature-reporting-insert-page-bre...)
I did not add the repeat count to the survey and the data collection has been completed already. Is there any way to achieve this (page break for each new repeat feature) without the repeat count? That post is only a few months old but wanted to check if someone figured out new ways to handle it.
Solved! Go to Solution.
Hi @Anonymous User
You can use the ${$feature | getValue: "position"} as the repeat count. Here is the explanation of getValue:"position" in the doc:
To display the index of a repeat record, use the getValue expression with the reserved keyword $feature. This example will produce 1 for the first record in a repeat, 2 for the second, and so on:
${#defects}
${$feature | getValue: "position"}
${/}
So you can use this expression in your template to insert page break before each repeat except for the first repeat.
If you need, you can also use ${repeat1 | getValue:"count"} to return the number of instance of repeat1.
Thanks,
Ruth
Hi @Anonymous User
You can use the ${$feature | getValue: "position"} as the repeat count. Here is the explanation of getValue:"position" in the doc:
To display the index of a repeat record, use the getValue expression with the reserved keyword $feature. This example will produce 1 for the first record in a repeat, 2 for the second, and so on:
${#defects}
${$feature | getValue: "position"}
${/}
So you can use this expression in your template to insert page break before each repeat except for the first repeat.
If you need, you can also use ${repeat1 | getValue:"count"} to return the number of instance of repeat1.
Thanks,
Ruth
Ruth,
This worked beautifully - I appreciate your help! Somehow the if statement persisted on printing "true" but I wasn't sure how to hide it so I ended up styling the statement in white font.
Hi @Anonymous User ,
If you need help to remove the "true" from your report, you can share your report template here.
Thanks,
Ruth
Hi @Ruth_JiatengXu - I'm attaching the report template here. I've stripped off the content from the parent feature, but the page #2 is where the repeat questions display. Then the page #3 shows some more questions from the parent feature. From your screenshot, it seemed I needed an additional closing tag. But once I added it, it skipped showing the first repeat question altogether so I resorted back to using white font. Attached template outputs something like this:
Hi @Anonymous User
I modified your template, and it should work now.
Few things to notice:
1. The following expression inserts a page break before each repeat, except for the first repeat instance. If you put the table between ${if ...} ${/}, then the table will not be printed for the first repeat instance.
${if ($feature|getValue:”position”)!=1} page break ${/}Observation
2. The ${if ...} ${/} needs the closing tab ${/} to work, and a space is needed between if and the expression.
3. If you only want to output the instance number without the if statement, you can simply use ${$feature | getValue: "position"}.
Thanks,
Ruth
Thank you for the detailed guidance, @Ruth_JiatengXu !
I'm also having some trouble with this and I'm wondering if anyone here could help out:
I have a report that I want to print out only repeat data with a new page for each entry.
It starts with:${#repeat name}${if ($feature | getValue: “position”)!=1}, then has some MS Word tables with fields from the repeat, and ends with ${/}${/}
I feel like that should be working but I keep getting errors like Error: An error occurred when checking the report template. The tag beginning with "}$repeatEn" is unopened. The start tag ${# UASPreFlightChecklist} is unclosed.
Hi @ZachBodenner ,
I am sorry for the late response. The close tag in your template might be the cause of this issue.
Thanks,
Ruth
@Ruth_JiatengXu - would there be a way to get the LAST position, without having a repeat count in the form?