Survey123 Report: Page Break for Repeat Feature

789
6
Jump to solution
07-01-2021 12:22 PM
by Anonymous User
Not applicable

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.  

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Ruth_JiatengXu
Esri Contributor

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.

Ruth_JiatengXu_0-1625471821108.png

If you need, you can also use ${repeat1 | getValue:"count"} to return the number of instance of repeat1.

Thanks,

Ruth

View solution in original post

6 Replies
Ruth_JiatengXu
Esri Contributor

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.

Ruth_JiatengXu_0-1625471821108.png

If you need, you can also use ${repeat1 | getValue:"count"} to return the number of instance of repeat1.

Thanks,

Ruth

by Anonymous User
Not applicable

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.     

0 Kudos
Ruth_JiatengXu
Esri Contributor

Hi @Anonymous User ,

If you need help to remove the "true" from your report, you can share your report template here.

Thanks,

Ruth

0 Kudos
by Anonymous User
Not applicable

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: 

AhjungKimSTN_0-1625673097582.png

 

0 Kudos
Ruth_JiatengXu
Esri Contributor

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

0 Kudos
by Anonymous User
Not applicable

Thank you for the detailed guidance, @Ruth_JiatengXu ! 

0 Kudos