Select to view content in your preferred language

if and statements in a report template

217
1
09-06-2024 02:41 PM
PavlovaVitale
Emerging Contributor

Hello, I am using Survey123 and I developed a report template with the following syntax: 

${if QSPDirectlyManaging == “No”} and ${QSPManagementPlan == “No”}A QSP is not directly managing properly implementation, management, and monitoring of the SWPPP and General Permit requirements by being present on site for all required SWPPP activities. A QSP is not managing the site through a communication plan that allows the QSP to actively and effectively manage trained personnel conducting SWPPP activities.${/} 

I am getting what I want when I run the report but I also get this phrase embedded in it: andTrue

See the example below:

and trueA QSP is not directly managing properly implementation, management, and monitoring of the SWPPP and General Permit requirements by being present on site for all required SWPPP activities. A QSP is not managing the site through a communication plan that allows the QSP to actively and effectively manage trained personnel conducting SWPPP activities.   

Is there a way to not have that phrase andtrue come up? it is not part of the code that I wrote above and it is showing.  thank you

 

0 Kudos
1 Reply
abureaux
MVP Frequent Contributor

${if QSPDirectlyManaging == “No” && QSPManagementPlan == “No”}

 

EDIT: For clarity "andTrue" is coming from this this interaction:

${if QSPDirectlyManaging == “No”} and ${QSPManagementPlan == “No”}

and True

Basically, the "and" is just sitting there like plain text. And that second statement (QSPManagementPlan == “No”) is resulting in either "True" or "False" and literally doing nothing else.

To get multiple statements to work together in an IF() statement within the Feature Report, you need to utilize Feature Report logic (more info here). The following logical operators are supported in if statements:

||

True if one of two statements returns true

&&

True if both given statements return true

!

True if the statement is not true

==

True if the two given values are equal to each other

!=

True if the two given values are not equal to each other

>

Evaluates whether the first value is greater than the second value

>=

Evaluates whether the first value is greater than or equal to the second value

<

Evaluates whether the first value is less than the second value

<=

Evaluates whether the first value is less than or equal to the second value

0 Kudos