How to display individual results from iterated records

675
8
01-25-2023 12:10 PM
JesseStoutStout
New Contributor II

I am able to display my survey results of onsite_representatives records all at once with the code snippet I'm using in my word document template (${#signatures} ${onsite_representative}${/}), as it iterates through them all (see output screenshot at top).The website I'm using as a reference (link at bottom) says "to display records in a table, put the start tag ${#signatures} in the first cell of the table and the end tag ${/} in the last cell of the table. That worked but displayed results vertically in a column instead of a 1 row 3 column output  like I wanted (see middle screenshot). So my solution is to call each result individually per cell so it can read Andrew (Row 1 Column 1), Pete (Row 1 Column 2), Jesse (Row 1 Column 3). Does anyone know how to do this? I tried 

${#signatures} ${onsite_representative|resultRecordCount:1}${/}" but when uploading to survey123 got this error (bottom screenshot).

 

JesseStoutStout_0-1674676729245.png

JesseStoutStout_2-1674677202931.png

JesseStoutStout_3-1674677399051.png

 

Website Link: https://survey123.arcgis.com/featureReport/quickReference?surveyItemId=65ccb653d87d4183b1464905861c4...

 
0 Kudos
8 Replies
Katie_Clark
MVP Regular Contributor

Will there always only be a maximum of three on-site representatives, or could there be more? If say, five names were entered, how would you want those to display?

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
0 Kudos
abureaux
MVP Regular Contributor

abureaux_0-1674756551739.png

 

If you provide the Feature Report (docx) and give a little more detail on how you would like the output to look, it would be helpful.

Second example I have above is just demonstrating how you would pull additional fields from your signatures repeat, and how it would ultimately look in the Feature Report.

 

If this is what you are hoping for:

abureaux_1-1674756858714.png

You cannot do this dynamically with a repeat. You will have to hard-code in the fields. You can do this with items in a repeat, but that doesn't seem like the most optimal set-up.

 

You can do something like this though relatively easily (with the advantage of it being dynamic):

abureaux_2-1674757000060.png

 

JesseStoutStout
New Contributor II

Thanks for your reply. Yes I am aiming to do this:

JesseStoutStout_0-1675089614991.png

Although the option you have at the bottom...(screenshot below) would also suffice. Would you mind elaborating a little on how to do that? 

JesseStoutStout_1-1675089702745.png

 

0 Kudos
abureaux
MVP Regular Contributor

As previously mentioned, you could do the first method, but hard-coding it to appear that way would be the easiest solution.

As for the second solution, you will want something like this:

abureaux_0-1675092326236.png

No tables needed. Just centre align the text and you're good to go. That closing tag will be where the next name appears. You can play around with the numbers in the size parameter to get the signatures to appear properly (more on that here under Images and Other Attachments).

JesseStoutStout
New Contributor II

Thanks again, I see. So for that second solution I had entered: 

${#signatures}${onsite_representative}

${#signatures} ${rep_signature | size:400:300}

${/}

center aligned in my word document. When uploading to Survey123 got the error shown in the (top) screenshot below. I then tried to enter:

${#signatures}${onsite_representative}

${/}

${#signatures} ${rep_signature | size:400:300}

${/}

which didn't give me any errors but gave me the output in the lowermost screenshot.

JesseStoutStout_0-1675111320364.png

JesseStoutStout_1-1675111617140.png

 

 

0 Kudos
abureaux
MVP Regular Contributor

A few things to keep in mind:

  • For a repeat, you need a start tag and end tag.
    • The start tag must match the name of of the repeat in Survey123 which you are trying to pull data from (in your case, it is signatures).
    • Nesting repeats is fine, but each repeat requires its own start tag and end tag.
    • Start tags for repeats must include a #. For example, ${#stuff} is a start tag to a repeat, while ${things} is a regular field.
  • Where you place the end tag will determine where the next record in that repeat will appear. For example, you could press ENTER a few times before that end tag to have space between the records. Doing this will mean that the last record always has extra space after it.
  • You can call on any single repeat as many times as you like, and can extract whatever data you'd like. You will only pull data if you include a specific tag in the repeat.
  • You cannot call on a field that is located inside a repeat without enclosing it in a repeat tag. In your example, ${onsite_representative} is located within the signatures repeat. You cannot call on this field without enclosing it in ${#signatures} ${/}

 

For your examples...

Example #1:

${#signatures}${onsite_representative}
${#signatures} ${rep_signature | size:400:300}
${/}

You have two start tags but only one end tag.

Example #2:

${#signatures}${onsite_representative}
${/}
${#signatures} ${rep_signature | size:400:300}
${/}

You placed the second end tag in such a position that you have effectively created two separate repeats. Both repeats reference signatures, but both are pulling different information. The first only pulls the Site Representative's name, and the second only pulls the Site Representative signature.

Try this:

${#signatures}${onsite_representative}
${rep_signature | size:400:300}
${/}
0 Kudos
JesseStoutStout
New Contributor II

I see. When I tried that I got this error:

JesseStoutStout_0-1675800808795.png

 

0 Kudos
abureaux
MVP Regular Contributor

Can you link your Excel and Word file?

0 Kudos