Hi everyone,
I am trying to write a syntax for a report template that displays a value when another value is true and display a "\" or "-" if there was no entry.
For example - if they answered "yes" to Q1. then display the answer to Q.2, otherwise "-" is displayed. I tried the else statement but I must have something wrong because it is giving me a parse error.
Thanks
There really isn't an if/else statement as we would expect in the template. It is an if/then nothing statement where nothing happens if the if statement isn't met. What you'd need to do is set up 2 if statements one for if q1 = yes and another statement for if q1 = no.
It would look something like this, assuming a select one question for the yes/no response:
${if q1 | selected:"yes"} ${q2} ${/}
${if q1 | selected:"no"} - ${/}
Here's the page for conditional formatting for more guidance.
Conditional report elements—ArcGIS Survey123 | Documentation
Can I do that but if there is no value in q1 that it would return \? for example:
${#CatchRun}
${if catchRunNumber == 1}${catchRunPressure}${/}
${if !catchRunNumber} \
${/}
I'd try ${if catchRunNumber == null} Text here ${/} and see what happens. It worked as a solution here: https://community.esri.com/t5/arcgis-survey123-questions/survey123-report-insert-text-for-null-value...
No luck. This is in a repeat table - see photo. If there are only 3 catch runs entered (for ex.) i want all the rest of the boxes filled with a "\" or "-" . I have tried ${ if catchRunNumber !=1} / ${/} but then i get / / / in my report. If you can guide me how to format this repeat table to only show values entered that would be great too but based on my findings, this is not possible.
I've attached a screenshot of how I iterate through a repeat table that I use for stratigraphy recorded in the field. I call the repeat ${#Stragiraphy} in the first column of the table layout all the fields I need and close the repeat inside the table with the ${/} after "multiline". This creates a seamless table that iterates through all the related repeats. If you don't have to follow a standard for how your data is presented you might explore reformatting how it is laid out.
If you have to maintain the formatting, you might try $feature | getValue: "position" as a query. I attached a mock up docx of how I'd try to get it done while maintaining the formatting. I haven't tested this, so it may or may not work. I also reduced the number of times you call the repeat table, rather than opening and closing the repeat for each cell, I call it for a row in your report table and close it at the end.
https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-repeats.htm
https://doc.arcgis.com/en/survey123/browser/analyze-results/featurereport-expressions.htm
You might be better off setting up the logic within the survey instead of the report. Have a hidden field in your survey for each box in your table and perform the calculation there. Then you can just call that field in your report.