Survey123 Formula

530
2
Jump to solution
06-16-2021 07:24 AM
JasonSimpson
New Contributor III

I am trying to populate a comment box with a specific comment based off the answer from a multiple choice question. There are three total choices for the multiple choice, Compliant, Non-Compliant, No Comment. The formula I have come up with is below. 

 

(if(selected(${VSMPSWPPP_SWPPP_MS1},'Compliant'), 'In Compliance',if(selected(${VSMPSWPPP_SWPPP_MS1},'Non-Compliant'), 'Non-Compliant Comment'), if(selected(${VSMPSWPPP_SWPPP_MS1}'N/A'), 'SWPPP Not Inspected'))))
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

You have a ( at the beginging and a ) and , in the wrong spots.  Also you need the else part on the last if.  I just gave it '' for now (this would be the case where nothing at all is selected).

if(selected(${VSMPSWPPP_SWPPP_MS1},'Compliant'), 'In Compliance',if(selected(${VSMPSWPPP_SWPPP_MS1},'Non-Compliant'), 'Non-Compliant Comment', if(selected(${VSMPSWPPP_SWPPP_MS1}, 'N/A'), 'SWPPP Not Inspected', '')))

Try that.

View solution in original post

2 Replies
DougBrowning
MVP Esteemed Contributor

You have a ( at the beginging and a ) and , in the wrong spots.  Also you need the else part on the last if.  I just gave it '' for now (this would be the case where nothing at all is selected).

if(selected(${VSMPSWPPP_SWPPP_MS1},'Compliant'), 'In Compliance',if(selected(${VSMPSWPPP_SWPPP_MS1},'Non-Compliant'), 'Non-Compliant Comment', if(selected(${VSMPSWPPP_SWPPP_MS1}, 'N/A'), 'SWPPP Not Inspected', '')))

Try that.

JasonSimpson
New Contributor III

Perfect. Thanks for your prompt response.