Select to view content in your preferred language

Conditional choice filtering through multiple cascades

1420
4
08-10-2020 11:29 AM
AliciaRitzenthaler
Occasional Contributor

I am trying to created a series of 3 questions asking survey respondents to "rank" their top 3 choices from a list. I want to prevent respondents from selecting the same choice for multiple ranks. However, I want to include 'other' as an option every time. How do I do this?

Using the choice filter field I am able remove already selecting options from subsequent ranks.

Rank 1 selection: A

Rank 2 choice filter: not(selected(${rank1},name)#

Rank 2 choices: B, C, D, E, Other

Rank 2 selection: C

Rank 3 choice filter: (not(selected(${rank1},name))) and (not(selected(${rank2},name)))

Rank 3 choices: B, D, E, Other

I can get this approach (or_other and choice_filter) to work for Rank 2 but I can't seem to apply it to a third 'cascade'.

How do I do this?

James Tedrick

Tags (2)
0 Kudos
4 Replies
by Anonymous User
Not applicable

Hi Alicia,

Can you provide a copy of your xlsx file so we can take a closer look. Are you using select one or select multiple question types?

Note that with 3.10 and previous releases choice filters only work for select one questions. We are currently working on development for 3.11, and will introduce choice filters to work on select multiple questions, which I believe it what you will require based on your example above.

Please keep an eye out for the 3.11 beta updates on the Early Adopter Community if you would like to test this out once it is available.

Regards,

Phil.

0 Kudos
AliciaRitzenthaler
Occasional Contributor

See attached. 

The Rank your choice questions is in theory how I want this to work...except I'd like 'other' to appear each time. 

The Choose your favorite questions I attempt a different (failed) approach to accomplish the same goal. 

As a third possible solution I'm 100% okay with added some calculated, read-me field which calculate "does rank 1 = rank 2? If so bad. And setting a constraint so that 'bad' is not an acceptable answer and you must revise rank 1 or 2. Survey 123 won't see to read a nested if statement though (if ${rank3}=${rank1},'bad', if(${rank3}=${rank2},'bad', 'good') in the calculation field....

0 Kudos
AliciaRitzenthaler
Occasional Contributor

That doesn't seem to have attached. Try this. Test_v1.xlsx - Google Drive 

0 Kudos
by Anonymous User
Not applicable

Hi Alicia,

Sorry for the delay in getting back to you, it has been a busy week. I had a look at the Test_v1.xslx file you provided and the example in the calculation field.

Nested "if" statements are supported in all calculation and expression fields, the issue is that you are trying to use an "or" statement in the calculation with multiple "if" statements. This is not a nested "if" statement and will not work due to the "or" operator. Also in your example in above post, the location of brackets is incorrect.

The correct nested "if" statement format to use is as follows, as an example:

if(${test3}=${test1},'bad',if(${test3}=${test2},'bad',if(${test1}=${test2},'bad','good')))‍

If you prefer, to make it easier to read, you can break it out onto different lines and tabs for each component of the "if" statement, and if you use NotePad++ or similar IDE, you can check the formatting and brackets as you go:

if(${test3}=${test1}
	,'bad'
		,if(${test3}=${test2}
			,'bad'
				,if(${test1}=${test2}
					,'bad'
						,'good'
					)
			)
	)‍‍‍‍‍‍‍‍‍‍

In the above example, if any of the "test" fields equal another "test" field, the value returned is "bad", but if none of them match, the value returned is "good".

Hope this helps, and it should work well for your use case, we see many other customers using nested "if" statements in this way.

Regards,

Phil.

0 Kudos