Select to view content in your preferred language

Repeat Groups with Conditionals in Survey123 Report Not Working

19498
28
Jump to solution
11-04-2020 06:08 PM
MichelleTanner
Regular Contributor

Hello! I am trying to build a report that displays repeat groups in a report. Not all of these repeat groups are required, so I only want to show which groups have records in the report. 

However, I keep running into the error: An error occurred when checking the report template. Failed to parse ${sc1}. The field name or parameters cannot be found in the current parsing scope.

I am at my witts end. I believe I have the syntax correct and have triple checked everything, but it still will not work!  

Here is an example of the repeat group with conditionals. Ideally I put this in a nicely formatted table, but I am still just trying to figure out the syntax:

repeat group = sc1

each question within the group is then labeled sc1_l, sc1_f, etc.

${#sc1}${if sc1}Drainage Inlet Protection

  • Location ${sc1_l}

  • Type ${sc1_ft}

  • Findings(s) ${sc1_f}

  • Notes ${sc1_n}

  • Photos ${sc1_p1 | size:375:0:0:600}${/}${/sc1}

Am I missing something here?? Thanks.

0 Kudos
28 Replies
BarbaraWebster1
Esri Regular Contributor

Hi Janella,

Thanks for sharing your forms. It looks like the end tag for the repeat is outside of the table that the rest of the repeat is in and that this is causing the error when a record includes multiple entries in the repeat section. 

If you move the end tag in your report template inside the table (to just after "${B_ServiceTec}") does that resolve the error for you?

-Barbara

0 Kudos
JanellaFlook
Emerging Contributor

Thanks Barabara,   I moved the end tag to the end as you stated and it now prints the same fields twice.  I have moved the closing tag to several different placed in the form and still prints the repeat fields twice?   I have attached and highlighted the print report and the template used. 

0 Kudos
JanellaFlook
Emerging Contributor

Barbara,   I just noticed, at this point I have two test survey124 forms completed for this location.  It is printing both Repeat sections for each date, one below the other.  I need to print only the last form completed.  What happens when I have multi forms (inspections) completed for the same location... will it print all?  How do I print only the most current? 

0 Kudos
BarbaraWebster1
Esri Regular Contributor

The default behavior for a repeat in a report is for each repeat to be shown, but you can limit which repeats are shown in the report by adding a query to the repeat start tag in the report.

For your report template you could change ${#BiAnnual} to ${#BiAnnual| orderByFields:"B_Inspection DESC” | resultRecordCount:1} . This would order the repeats by the date field and then limit the repeats shown in the report to one, so only the most recent inspection would be shown.

JanellaFlook
Emerging Contributor

Looks Like that worked.  Thanks Barbara for your assistance

0 Kudos
BarbaraWebster1
Esri Regular Contributor

No problem, glad that worked for you!

0 Kudos
justin_scott8
Emerging Contributor

Hello Barbara, I am running into the same error as above.  I have attached my feature report template and .xls form here.  Thanks for looking into it.

0 Kudos
BarbaraWebster1
Esri Regular Contributor

Hi Justin,

All of the repeat end tags should be inside the table instead of after the table. The end tag should go after the last question in the table. See the attached report template with those changes incorporated.

You can also see the Repeats section of the Survey123 Report Templates Documentation for more information. 

Thanks,
-Barbara

0 Kudos
jantolihao
Regular Contributor

Hello, @BarbaraWebster1.

I hope you are doing fine.

I have here a sample form (Sample Building Form.xlsx) with a repeat group. I am trying to generate a report using the attached feature report template (Sample Report Template.docx). However, I keep getting the same error above. So, I tried revising the report template. However, the output looks like this (please see screenshot below). I have attached the same generated output PDF as well (Sample Generated Report.pdf).

jantolihao_0-1667562089292.png

I noticed that each item in the "Additional Items" column were printed thrice. I only wanted to print every single item in the "Additional Items" column, whether they have entries or none, only once. I prefer to have an output something like this. (Please see screenshot below)

jantolihao_1-1667562717036.png

Do you have any suggestions on how to come up with this output? I did a couple of tests, but I couldn't figure it out how to revise my feature report template. Am I missing something out?

Thank you in advance for looking into it. I appreciate any ideas. Thanks again.

 

0 Kudos