Select to view content in your preferred language

Compare two survey questions

412
1
Jump to solution
10-11-2017 08:26 AM
RenatoSalvaleon
Frequent Contributor

Using the If function, does Survey123 allow the use of a conditional formula that compares two answers?

Here's my formula on the calculation cell:

if((selected(${lst_missionstatus})=${note_default_page}), ${lst_missionstatus}, ${note_default_page})

So if the value of lst_missionstatus and note_default_pge are the same, the value for this question is that of note_default_page, otherwise its value lst_missionstatus.

Survey123 keeps returning with an error that there is only one argument in my condition.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RenatoSalvaleon
Frequent Contributor

I resolved the issue with this: 

if((selected(${lst_missionstatus},${note_default_page})), ${note_default_page}, ${lst_missionstatus})

but it did not do what I wanted to accomplish for my relevant field.

I ended up with this.

if((selected(${lst_missionstatus},'')), ${note_default_page}, ${lst_missionstatus})

The challenge was note_default_page is loaded on form load and the other one is populated with a select, so on form load the question is always null. So I just reversed the logic and now its working.

View solution in original post

0 Kudos
1 Reply
RenatoSalvaleon
Frequent Contributor

I resolved the issue with this: 

if((selected(${lst_missionstatus},${note_default_page})), ${note_default_page}, ${lst_missionstatus})

but it did not do what I wanted to accomplish for my relevant field.

I ended up with this.

if((selected(${lst_missionstatus},'')), ${note_default_page}, ${lst_missionstatus})

The challenge was note_default_page is loaded on form load and the other one is populated with a select, so on form load the question is always null. So I just reversed the logic and now its working.

0 Kudos