Select to view content in your preferred language

choice_filter with using multiple question dependencies

265
5
Jump to solution
Sunday
GeoWorld13
Occasional Contributor

I am trying to configure a survey that applies choice filtering for 3 questions. Here are the scenarios:

1. {tribal_gov} = Yes: show all 32 choices

2. {tribal_gov} = No, {state_esf} = No: show all 32 choices

3a. {tribal_gov} = No, {state_esf} = Yes, {esf_num} = 1 : show 1 choice

3b. {tribal_gov} = No, {state_esf} = Yes, {esf_num} = 2 : show 3 choice

3c. {tribal_gov} = No, {state_esf} = Yes, {esf_num} = 3 : show 2 choices

Some core capabilities can apply to multiple esf numbers 

Scenarios 1 and 2 work. Scenarios 3a, b, and c do not. The drop-down option is not available in scenarios 3a, b, c

GeoWorld13_0-1778425691769.png

choice_filter statement: ${tribal_gov}='Yes' or ${state_esf}='No' or selected(esf_filter, ${esf_num})

Choices tab:

GeoWorld13_2-1778426106807.png

I am adding a space between each ESF. Perhaps that is not correct? esf_1 esf_2

GeoWorld13_4-1778426441880.png

GeoWorld13_5-1778426540350.png

 

2 Solutions

Accepted Solutions
Georgios-NektariosTselos
Regular Contributor

Hi @GeoWorld13 , 

It looks like the issue is in the logic used for scenarios 3a/3b/3c.

When {state_esf} = Yes, your choice_filter probably needs to evaluate BOTH conditions together:

  • ${esf_num}

  • and the values used in the choices sheet

If some capabilities belong to multiple ESF numbers, avoid using direct equality (=) against a concatenated field. Instead, use selected().

For example, if your choices sheet contains a column like:

esf_filter
1 2 3
2 5
1

then your choice filter should be something like:

(${tribal_gov}='Yes') or
(${state_esf}='No') or
(${state_esf}='Yes' and selected(esf_filter, ${esf_num}))

The important part is:

selected(esf_filter, ${esf_num})

instead of:

esf_filter = ${esf_num}

because several core capabilities can belong to multiple ESF numbers.

Also make sure:

  • esf_filter values are space-separated (not comma-separated)

  • ${esf_num} matches the choice name values exactly

  • the choice_filter column is on the question using the filtered list

View solution in original post

Neal_t_k
MVP Regular Contributor

2 things, in your sample the esf_filters are in the media::audio column, they should be moved over a column to the left. And then I think it is all the blank cells in the esf filter column.  I filled them all with zeros and it worked.

Neal_t_k_0-1778559406194.png

 

View solution in original post

5 Replies
Georgios-NektariosTselos
Regular Contributor

Hi @GeoWorld13 , 

It looks like the issue is in the logic used for scenarios 3a/3b/3c.

When {state_esf} = Yes, your choice_filter probably needs to evaluate BOTH conditions together:

  • ${esf_num}

  • and the values used in the choices sheet

If some capabilities belong to multiple ESF numbers, avoid using direct equality (=) against a concatenated field. Instead, use selected().

For example, if your choices sheet contains a column like:

esf_filter
1 2 3
2 5
1

then your choice filter should be something like:

(${tribal_gov}='Yes') or
(${state_esf}='No') or
(${state_esf}='Yes' and selected(esf_filter, ${esf_num}))

The important part is:

selected(esf_filter, ${esf_num})

instead of:

esf_filter = ${esf_num}

because several core capabilities can belong to multiple ESF numbers.

Also make sure:

  • esf_filter values are space-separated (not comma-separated)

  • ${esf_num} matches the choice name values exactly

  • the choice_filter column is on the question using the filtered list

GeoWorld13
Occasional Contributor

@Georgios-NektariosTselos @Neal_t_k 

Thanks for the suggestion. For some reason I still cannot get the choice filtering to to work. I have attached a sample .xlsx form if you want to check it out.

Now, none of the scenarios work...but I can't figure out why?

1. {tribal_gov} = Yes: show all 32 choices

2. {tribal_gov} = No, {state_esf} = No: show all 32 choices

3a. {tribal_gov} = No, {state_esf} = Yes, {esf_num} = 1 : show Critical Transportation choice

Using this ${tribal_gov}='Yes' or ${state_esf}='No' works. It is adding the last part that throws something off

0 Kudos
Neal_t_k
MVP Regular Contributor

2 things, in your sample the esf_filters are in the media::audio column, they should be moved over a column to the left. And then I think it is all the blank cells in the esf filter column.  I filled them all with zeros and it worked.

Neal_t_k_0-1778559406194.png

 

GeoWorld13
Occasional Contributor

@Neal_t_k Thank you!!!! Got it working now.

0 Kudos
Neal_t_k
MVP Regular Contributor

This may help with your multi-option part. You need the comma to separate the list items

Neal_t_k_0-1778504630532.png

Survey123 Tricks of the Trade: Choice Filters - Esri Community

After that, @Georgios-NektariosTselos appears to have the right logic above.