Pre-populate Select One/Select Multiple fields from CSV

4005
9
04-06-2017 08:22 AM
FrancisMalik
New Contributor

I'm developing a condition assessment form for which I would like to have all (or most) fields populated with the previous assessment data, dependent on the asset selected by the user. So far, all fields I've used (text, integer, etc.) can be pre-populated using the pulldata() calculation from a csv in the survey's media folder. However when I use the same function for a Select One or Select Multiple field, my choice filter Select One field (where the user selects an asset) no longer functions. Can a Select One or Select Multiple field use the pulldata() function without disrupting my other fields?

*Many of my Select One fields are likert questions, with a scale of 1-5, N/A, UNK. These fields would contain the actual condition assessment data that I'd like to have pre-populated.

0 Kudos
9 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Francis,

At this time select_one and select_multiple questions can't be calculated from within the form.  They can receive values via url parameters if the data is being loaded in that fashion.  I'm adding your request to the list of of requesters for this enhancement in our development log.

AndrewHansford
Occasional Contributor II

Hi JTedrick-esristaff‌ me again.  Was wondering if this has been progressed? I am keen to achieve this in the form that I am developing as well. Cheers Andrew 

JamesTedrick
Esri Esteemed Contributor

Hi Andrew,

We have not addressed this issue yet.  For reference, this is listed as BUG-000101154 in Esri technical support.  We are in the process of prioritizing issues to address between DevSummit and the UC; I'll see if this can be addressed in that time frame.

SarahAllerton
New Contributor

Hi James,

Have you addressed this issue? I am looking to pre-populate select_one and select_multiple questions from an external_choices list using a calculation/pulldata. 

Cheers. 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Sarah,

Select_one questions were able to be calculated as of Survey123 2.7.  Select_multiples will be able to be calculated with the next release (3.9).

0 Kudos
KristiLeeHalpin
New Contributor

Hi James, 

What'ss the syntax to properly use this? I'm struggling with setting up the external choices list for select_one question type. We're building a survey to collect vegetation data. Any help you're able to provide is appreciated. Thanks

0 Kudos
DougBrowning
MVP Esteemed Contributor

It could be you are trying to use text in your query?  You cannot for some reason. 

So instead put the text in a field like this

type     name  label  Calculation

hidden fulllist fulllist   "Y"
hidden nonplant nonplant "NonPlant"
hidden woody woody "Woody"
hidden herb herb "NonWoody"
hidden none none "None"
hidden unknown unknown "Unknown"

Then use those fields in your choice filter

Type=${NonWoody} or Type=${None}

or for the full list

fulllist=${fulllist}  this tells it to match the column fulllist with the value in the field ${fulllist} (turns into fulllist = "Y" then matches that column below.

Sample external_choices sheet

list_namenamelabelTypeGrowthHabitSubDurationFoliarfulllist
PlantsListNN     NoneNoneNone
PlantsListHLHL     Herbaceous LitterNonPlantNonPlantY
PlantsListWLWL     Woody Litter > 5 mm NonPlantNonPlantY
PlantsListNLNL     Other Litter (plastic metal decaying animal tissue)NonPlantNonPlantY
PlantsListDSDS     Deposited soil overlying live plant baseNonPlantNonPlantY
PlantsListVLVL     Vagrant LichenNonPlantNonPlantY
PlantsListGRGR     Gravel overlying plant baseNonPlantNonPlantNonPlantY
PlantsListCBCB     Cobble overlying plant baseNonPlantNonPlantNonPlantY
PlantsListSTST     Stone overlying plant baseNonPlantNonPlantNonPlantY
PlantsListABANABAN    Abronia angustifolia    purple sand verbenaNonWoodyForbAnnualYY
PlantsListABBIABBI    Abronia bigelovii    Galisteo sand verbenaNonWoodyForbPerennialYY

Hope that helps.

0 Kudos
KristiLeeHalpin
New Contributor

Hi Doug,

That's helpful, but I'm still not doing something right. I don't want to use the cascade option, but maybe I have to in order to make this work? Or perhaps my syntax for the question is incorrect. This is what I have:

type   name   label   choice_filter
hidden   fl   FullList
select_one_external list_PlantList   spp1name   Species   fl=${fl}

And my external_choices sheet looks like this

0 Kudos
DougBrowning
MVP Esteemed Contributor

Looks like you have the list name wrong.

In the external_choices sheet you call it PlantList but in the type column you have select_one_external list_PlantList. Should just be select_one_external PlantList.  Not sure why you are putting list_ in front of it.

Try that but the special char | may cause an issue.  For sure make sure your external list has no Commas at all in it.

And yes choice_filter must have at least something in it.  You can make it be the whole list like you are but it need something.

Hope that works.

0 Kudos