Choice Filter on External Choice List

682
4
10-13-2022 05:12 AM
Nihe_N8
New Contributor II

Hello,

I'm trying to filter an external choice list based off of the answer to a previous question. The external choice (caid.csv) list contains the tens of thousands of unique identifying caids associated with either line, point or polygon feature types.

The user needs to be able to select the feature type (select_from featuretype (choices tab on xls form)) and then I need only the caids associated with that feature type selected (either line/point/polygon) appear in the dropdown list from the external caid.csv in the select_from_file caid.csv question type. The external caid.csv (held in the media folder) looks like this below for example.

namelabelfeaturetype
111111polygon
112112polygon
113113polygon
43324332line
43334333line
43344334line
4330043300

point

 

I have tried using the following calculation in the select_one_from_file caid.csv question type choice_filter selected($featuretype},featuretype) but it still brings the caids associated with lines even though the featuretype selected is polygon. Any ideas? Thanks.

0 Kudos
4 Replies
DougBrowning
MVP Esteemed Contributor

These tend to be the case does not match or using label vs name.  Can you post the form hard to troubleshoot without it.

You could also break up the csv then use select_one_from_file ${calculatedname} or the new search() appearance type.  Note using these breaks domains however.  But most domains are off anyway.

Hope that helps

0 Kudos
Nihe_N8
New Contributor II

Hi Doug, cheers. I've attached the forms (I removed my formula from the choice_filter).

Originally I had separate csvs for the caids of each feature type, but this was taking ages to load the survey once I got further into the devlopment of it, hence why I'm now trying to do cascade selects within one csv.

Let me know what you think.

- Nick

0 Kudos
DougBrowning
MVP Esteemed Contributor

Looks like you have one question for each type.  I would break the csv into 3 then.  That should be faster not slower so not sure why you saw that.  Do not use choices just 3 CSV files.

Your choice filter looks ok I think but it was removed so not sure.  Sorry I am not much help.

I tried your form but I get this weird error

DougBrowning_0-1665675607022.png

 

0 Kudos
Nihe_N8
New Contributor II

Hmm, not sure why you get that error. Can you try again with the forms below please - I looked over it and there were a couple of question types I'd added while testing which I've removed as they aren't needed. Thank you.

* edit reply - this now appears to be filtering the caids by featuretype. No idea why it is now working, Survey123 has been very temperamental lately(possibly network issues at work). Anyway, thanks for your previous input Doug. It's appreciated.