Select to view content in your preferred language

choice_filter and external choice list

4398
10
Jump to solution
08-17-2021 10:26 AM
hsem_sturgill
Occasional Contributor

I am struggling to implement the choice_filter in Connect while referencing a csv file.

As shown below, I have a County question that will then cascade select for the Township question. If I don't have a choice_filter the Townships will show up in my survey, so I know I got the csv linked correctly.But I cannot get it to work with the choice_filter included. My "county" column in the township.csv file is not being recognized. In the screenshot posted, my survey is opened on the left. I have the counties in the Choices tab of the survey since there are only 87 of them. However, since there are thousands of townships I added them to an excel sheet and exported as csv. I have three columns for the csv: 'name', 'label', and 'county'. If I am understanding the below article correctly, then what I have should work, but the article only talks about having all of your choices in the survey or having them all in a linked csv. What I could not find in the article is what the csv is supposed to look like in order to create the "link" between the county selected and the townships displayed.

side note: I only have some of the counties filled in within the townships.csv file because it is going to take some time to reference all of them and I wanted to see if it would work first.

I feel like I am missing something really simple...

This is the article I am working off of: https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-choice-filters/ba-...

 

 

Type                                  name                       label                                           choice_filter

select_one location_countylocation_county<i>County:</i> 
select_one_from_file townships.csvtownships<i>Township/Unorganized Territory:</i>selected(${county}, county)

 

 

1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

Looks like the name of your field is location_county but you say county for some reason here selected(${county}, county). 

Prob want  selected(${location_county}, county)

View solution in original post

0 Kudos
10 Replies
DougBrowning
MVP Esteemed Contributor

Looks like the name of your field is location_county but you say county for some reason here selected(${county}, county). 

Prob want  selected(${location_county}, county)

0 Kudos
hsem_sturgill
Occasional Contributor

That worked! I thought the article was telling me to reference the column name from my townships.csv file, which is "county" for both parts of the formula. It had me real confused.

 

Note:  for whatever reason Survey123 Connect desktop app does not want to pull data from the external csv when doing a choice_filter. I had to upload the survey and open it in the Survey123 app to get it to work.

DougBrowning
MVP Esteemed Contributor

Make sure your connect is up to date is my guess.  from_file is newish

0 Kudos
hsem_sturgill
Occasional Contributor

I just started on this stuff two months ago, and is when I installed Connect. Just tried uninstalling and reinstalling. Still does not work for me. Not a big deal, except I kept thinking I was screwing something up with my formula until I tried it outside of Connect...

0 Kudos
DougBrowning
MVP Esteemed Contributor

Hmm something else may be off then.  It townships.csv in the media folder?  And it is all lowercase file name?

0 Kudos
hsem_sturgill
Occasional Contributor

Yes to both. What I found strange is that when I get rid of the choice_filter then the townships will populate in the Connect app (they just won't be filtered obviously). But when I have the filter then the list is blank. And I did select a county that has townships tied to it in my file. It all works fine though in the Survey123 App.

0 Kudos
MarkEastwood
Frequent Contributor

I am having the same issue @hsem_sturgill . Were you able to find the problem?

When I have a choice_filter added the list is blank, when I remove the choice_filter the list is populated. 

DougBrowning
MVP Esteemed Contributor

Post the form so we can help.  It is often a case sensitivity issue.

0 Kudos
AshneyDaniel
Emerging Contributor

The dependent field does not populate with values until the first, valid field value has been selected. If you are using a pull down (minimal type) then it will not even look like a pull down at first. It will look read only. Once the valid value is selected then it will switch to looking like a pull down with values.

The value entered into the first field must match to a value in your choices. There doesn't seem to be app validation for this. It doesn't tell you that a value is invalid. The dependent field just doesn't do anything.  

I had a situation where values in the choices csv were being filled from a script as doubles but I did not know it and assumed they were int values. I was entering int (non-decimal) values in the primary field of the survey so was never going to have a match. You may have gotten used to looking at the xlsform in Excel as I did. However, opening the choices csv in Excel auto-formatted the double value to appear as an int. Not helpful. Opening the csv in a text editor may show you a type mis-match. 

0 Kudos