Select to view content in your preferred language

Two way choice filter

1064
4
06-20-2018 11:55 AM
peterbrad2
Occasional Contributor

Hello,

Lets say I have two questions in my survey.

Select One: Species Scientific Name

Select One: Species Common Name

I would like to be able to select either question depending on my knowledge of the species and have the other populated with its corresponding name. For example, say I find a species while doing field work and I know its common name, but I cant recall its scientific name, it will automatically fill in the scientific name if I select the common name. I'd also like to be able to do it in reverse. For example, say I find a species while doing field work and I know its scientific name, but I can't recall its common name, it would automatically fill in the common name.

Is this possible?

4 Replies
NickDierks1
Frequent Contributor

Have you looked into pulldata()? You can probably set up pulldata() calculations on both questions that look up the other's answer in a table and pick the correct corresponding names. Selecting a scientific name should look up and populate the common name, and vice versa.

pulldata('NamesTable', 'SciName', 'ComName', ${ComName})

This formula, used as a calculation in your Scientific Name field, would populate the scientific name based on the common name you enter. 'SciName' and 'ComName' are fields in a csv you set up (NamesTable.csv). To calculate your common named based on the scientific name, just flip it around:

pulldata('NamesTable', 'ComName', 'SciName', ${SciName})

And if, for some reason, the two questions and their calculations don't play nice with eachother (you should be able to calculate select_one questions as of 2.7, but I haven't tried this yet myself), then you can try a workaround where your initial name selection questions are fieldType NULL, and pulldata() is used to populate two read-only text fields that are then passed on in the schema.

typenamecalculationbind::esri:fieldType
select_one SciNamesSciNamenull
select_one ComNamesComNamenull
textSciNameTextpulldata('NamesTable', 'SciName', 'ComName', ${ComName})
textComNameTextpulldata('NamesTable', 'ComName', 'SciName', ${SciName})
0 Kudos
peterbrad2
Occasional Contributor

Nick,

I might give this a try. Thanks for the reply!

-pete

0 Kudos
DougBrowning
MVP Esteemed Contributor

In my project I did my labels like this since while using the autocomplete style Survey123 will find string combos in the code or name just fine.

Typing in ABL or Hook would get you the first one on this list.

label
ABLA     Abies lasiocarpa (Hook.) Nutt.     subalpine fir
ACGL     Acer glabrum Torr.     Rocky Mountain maple
ACMI2     Achillea millefolium L.     common yarrow
ACHY     Achnatherum hymenoides (Roem. & Schult.) Barkworth     Indian ricegrass
ACNE9     Achnatherum nelsonii (Scribn.) Barkworth     Columbia needlegrass
ACRI8     Achnatherum richardsonii (Link) Barkworth     Richardson's needlegrass
0 Kudos
peterbrad2
Occasional Contributor

Doug,

This is exactly how I set it up as an interim solution. Thanks for the reply!

-pete

0 Kudos