A user submits a survey via Survey123 app, and they can optionally take a photo if they like, I would like to show/hide the image section of my report based on wether a photo was taken. So if they only take two photos, only show the first two image tags, hide the rest.
It's currently setup like this:
I did read in another post that I should be using something like ${if photo1} but I have no idea how to implement that above, I have tried several variations and none have worked. Could someone please show me how to write the below two lines so that they are only included in my Survey123 Report if a photo was taken?
Image
${weed_image01 | size:500:0}
Thanks for your time.
Solved! Go to Solution.
I am a goose! I have been looking for an error in the wrong places... I need to add a dollar sign to the close brackets.
This is the correct code I should have been using:
${if weed_image04}${weed_image04 | size:500:0}${/}
Thanks very much for your assistance
Hi Ben,
You can create a conditional section to only show information if a condition (such as if a photo is taken) is met. See Feature report templates—Survey123 for ArcGIS | Documentation for information.
Hey James, thanks for the reply. I should have mentioned in my OP that I had tried the following, both of them failed:
Image
${if weed_image01}${weed_image01 | size:500:0}{/}
Image
${if weed_image01 | size:500:0}
Image
${if weed_image01}
I am basically asking if anyone can correct my code that I am attempting to use? I have found the documentation is not very clear with this stuff (lacking full examples).
Cheers
Hi Ben,
The first entry is the pattern that should work - the if statement is evaluated and if true, the contents inside are displayed. Just to check, the questions were named 'weed_image01' in the form (a double-check against the xlsx file)?
Hey,
So I have added the code as described, to my template docx:
${if weed_image01}${weed_image01 | size:500:0}{/}
${if weed_image02}${weed_image02 | size:500:0}{/}
${if weed_image03}${weed_image03 | size:500:0}{/}
${if weed_image04}${weed_image04 | size:500:0}{/}
${if weed_image05}${weed_image05 | size:500:0}{/}
And I get this warning when I upload the template to they survey123 page:
Error:
The tag beginning with "}{/" is unopened.
The tag beginning with "}{/" is unopened.
The tag beginning with "}{/" is unopened.
The tag beginning with "}{/" is unopened.
The tag beginning with "}{/" is unopened.
The loop with tag "true" is unclosed.
The loop with tag "true" is unclosed.
The loop with tag "true" is unclosed.
The loop with tag "true" is unclosed.
The loop with tag "true" is unclosed.
Any ideas what I am doing wrong?
I have confirmed the field names weed_image0X are correct.
Cheers
I am a goose! I have been looking for an error in the wrong places... I need to add a dollar sign to the close brackets.
This is the correct code I should have been using:
${if weed_image04}${weed_image04 | size:500:0}${/}
Thanks very much for your assistance