Select to view content in your preferred language

Select_Multiple - return what wasn't selected

1316
4
Jump to solution
08-15-2018 11:27 AM
SueJohnston
Regular Contributor

Hi,

I'd like to return what wasn't selected from a select multiple question.  I know i can do it by adding a hidden field and returning the False or No value to that field, but i have a lot of fields.  Is there a way were i can do if count < #, return the choice that wasn't selected?  I would think that it's possible, but not sure of the field/syntax to try it.

Anyone else attempt something similar?

TIA!
Sue 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Sorry, I was a little sloppy on hte original function - that will be revised.

In the Red/Green/Blue example, the code would be:

concat(if(selected(${color}, 'red'),'','Red'),if(selected(${color}, 'green'),' ','Green '),if(selected(${color}, 'blue'),'','Blue'))

As you say, this generates a list (as there may be multiple values not selected).  The if() statement checks for each value and places no string (or a space to preserve formatting for a middle value like green) if the value is selected and the text if the value is not selected.

View solution in original post

4 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Sue,

As you say, you could do this with a concat() function joining separate if statements checking for the presence of a choice:

concat(if(selected(${q}, 'choiceA'), '','choiceA'), if(selected(${q},'choiceB'), '','choiceB'))

and so forth for each choice in the list.

Ed: revised function to be valid XLSForm

0 Kudos
SueJohnston
Regular Contributor

Sorry James, I'm not following exactly.  Wouldn't this give me a list?

If i have a question that says Red, Green, Blue.  Red and Green are checked, how do i get that the Blue wasn't?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Sorry, I was a little sloppy on hte original function - that will be revised.

In the Red/Green/Blue example, the code would be:

concat(if(selected(${color}, 'red'),'','Red'),if(selected(${color}, 'green'),' ','Green '),if(selected(${color}, 'blue'),'','Blue'))

As you say, this generates a list (as there may be multiple values not selected).  The if() statement checks for each value and places no string (or a space to preserve formatting for a middle value like green) if the value is selected and the text if the value is not selected.

SueJohnston
Regular Contributor

Ah, I get it now.  And it works like a charm!  Thanks so much James for you super quick and super helpful response!

0 Kudos