Select to view content in your preferred language

Autopopulate but for multiple fields at same time?

59
2
2 hours ago
SteveCole
Honored Contributor

Developing a form for field staff to go out and do plant surveys. Some staff are comfortable specifying a plant code, but others are more comfortable with common or scientific names. I've developed the UI to have a 3 option choice (Code/Scientific/Common Name) and then based on that choice a group appears where there is a pulldown for the user to type what they're looking for and then a PullData in the Calculation column then autopopulates the other two fields.

All of this works just fine but there could be situations that a user may need to switch options, because they don't know the plant code or whatever. That could result in data loss so I have created three hidden fields which I'd like to populate with the relevant information as a "final" resting place for that information.

So, is there a way to populate the UI as I am currently doing *AND* populate the hidden fields at the same time?

 

The UI:

s123_groupOptionUI.jpg

The XLSForm:

s123_groupOptionExcel.jpg

Thanks!

Steve

2 Replies
Neal_t_k
MVP Regular Contributor

I think you are going to need some compound if statements somewhere.

Assuming your select_one's are relevant on plantSearchType question:

SpCode:  if(string-length(${comSpComName})>0, ${comSpCode}, if(string-length(${sciSpSciName}>0, ${sciSpCode},${codeSpCode}))

and then repeat for each of your other hidden fields.

If you want to reduce lines, you could put the appropriate pulldata()'s inside of the if's instead of calling the notes field and make those visible all the time. The get rid of the notes.

Otherwise you could try coalesce() for your hidden fields.

Solved: Is there a way to use the coalesce calculation wit... - Esri Community

You have it mostly there. 

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

What I do is have the label column be Code    Scientific name    Common name all together with 4 spaces between each.

Then the user can search on any one of these all in one spot.

DougBrowning_0-1784744257467.png

Even if they just know part of the plant it narrows the list down to what is actually in their state.

DougBrowning_2-1784744692373.png

 

Then I set the name column to just be the code so that is all that gets stored so its all consistent.

DougBrowning_1-1784744446690.png

Works super slick.  Note I have 12 different state lists that are up to 60,000 each with no issues.

I use autocomplete with a calc of the state field to grab the correct CSV.  Using external csv for these big lists is much faster and I only load the state I need.

autocomplete search(${SpeciesListName}, "matches", "Plants", "Y")

Funny this is actually for our Wetland project also.  We do share our forms if you want them just pm me.

Hope that helps.