Select to view content in your preferred language

select_multiple, relevant

623
5
02-06-2024 09:33 AM
WFCAdmin
Emerging Contributor

I have a simple question regarding a survey123 connect I am building, specifically a 'select_multiple' option.

If field staff catch a fish, they will search through a species list.

I want to provide a filter for "other" and "salmonid". This part is simple.

In the relevant column, I am using the following.

for salmonids I am using ${fish_type}=’salmonid’ and for other I am using ${fish_type}=’other’. This works great, no problems.

Occasionally, staff will document multiple fish, possibly one from each filter. In this case, I would like staff to be able to select both the 'other' filter and the 'salmonid' filter.

I have been trying different combinations but failing each time. I expect it should look something like this?

${fish_type}=’salmonid’ or ${fish_type}= (’salmonid’ and 'other')

If anyone has suggestions it would be much appreciated.

Thank you

0 Kudos
5 Replies
DougBrowning
MVP Esteemed Contributor

Have you tried contains?

contains(string, substring)

Returns true if the given string contains the substring.

contains(${question_one}, 'red')

0 Kudos
WFCAdmin
Emerging Contributor

Thank you Doug,

Thank you Doug! I tried the following and it works great.

contains(${fish_type}, 'salmonid' or (’salmonid’ and 'other'))

 

DougBrowning
MVP Esteemed Contributor

I think this is the correct syntax though.

contains(${fish_type}, 'salmonid') or contains(${fish_type}, 'other')

0 Kudos
abureaux
MVP Frequent Contributor

Why not selected()? It is intended to be used with select_multiple for this purpose.

selected(${fish_type}, 'salmonid')

EDIT: I will add that contains() does work in places that selected() doesn't, such as a WHERE clause for an Inbox survey. But in this particular case, I'd go with selected() as the standard for ALL select_one and select_multiple.

DougBrowning
MVP Esteemed Contributor

Oh yea duh this is for a relevant.  So yea that is the better way really.