Survey123 Feature Report - Omit content if certain fields are empty

10-03-2023 10:13 PM
New Contributor II

This feels like a simple issue but I just can't get the report to work. 

All I want to do is use an "if" statement to either show or not show certain text if a field contains any text at all.

This is my current  approach. The syntax is validated as being correct, but I still get the empty categories showing despite their not being any value against them.

${if Themes_Environment != ""}Environment - ${Themes_Environment}${/}

${if Themes_People != ""}People - ${Themes_People}${/}

${if Themes_Economy != ""}Economy - ${Themes_Economy}${/}

${if Themes_Infrastructure != ""}Infrastructure - ${Themes_Infrastructure}${/}


0 Kudos
2 Replies
MVP Regular Contributor

Does it work if you just put ${if Themes_Environment}Environment - ${Themes_Environment}${/}


“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
MVP Regular Contributor

I normally do what @Katie_Clark suggested for omitting empty fields, and it works very well (aka, I can't recall a case where it didn't work off hand).

I don't believe that it is necessary, but as an alternative is you could try string-length: if(string-length(${question_name})>0)