Select to view content in your preferred language

Survey123 Feature Report - Omit content if certain fields are empty

444
2
10-03-2023 10:13 PM
Spatialelement
Emerging Contributor

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

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


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 Frequent 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)