Select to view content in your preferred language

Calculation being overridden by Search()

544
5
10-04-2023 09:55 AM
Ford_Rundell
New Contributor II

How can I set the default selection for my select_one dynamic list made with a search() appearance, preferably using pulldata() under the calculation field?

I'm using a search appearance pointing to a feature layer to populate a select_one list in Survey123 Connect. I am also using pulldata calculations throughout the form, pointing at the form's feature layer to autofill the last responses from the same vehicle.

For some reason, both the calculation and default fields for the question with search() are overridden with the list provided by search(). This defaults to a blank value, but has the pulldata() value as an option from the search() list. 

I have calculationMode=always set in the bind::esri:parameters column.

The entire survey works well other than this. Looking at "select_one stockpile_letters" in this screenshot:

temp_0-1696438337551.png

 

See attached spreadsheet.

 

I believe the same thing could be done via locally saved .csv files if all our users had the app, but most of them will be accessing this through a web browser.

 

Tags (2)
0 Kudos
5 Replies
DougBrowning
MVP Esteemed Contributor

I am not following why you have a calc and a pick list for Stockpile_letter.  Maybe to select previous but then users can add?  Seems   You will get the refresh button a lot on this.

Anyway I think one is firing before the other and not in the order you want.  I have also seen pulldata be weird when it is not by itself.  So move the pulldata out to a calculation field then try to have ${sometempfield} as your calc for stockpile_letter.  So basically make it 2 steps vs just one.  That often will fix it.  In your case that would reduce the number of pulldata calls also since you lookup the letter twice.

Hope that works for you.

0 Kudos
Ford_Rundell
New Contributor II

Thanks for the response. The context for this is that we have lettered stockpiles in stockpile areas in the field, which then get hauled in to our plants. This survey keeps track of which piles are being hauled. I am using the pick list to cut down the available options for users so they can only enter letters that correspond to valid stockpiles we have in the field. For example, we could have a pile ground with only stockpiles E, F and G. It would be easy for users to create an issue by entering stockpile 'B' if their options aren't filtered. As stockpiles disappear, they should be removed from the list of options dynamically. When stockpiles are hauled, they stay on the same stockpile for anywhere from 1 to 40 loads. The survey needs to be as simple and user friendly as possible, so I need to auto-fill the field with the last entry from that numbered truck but also give them the option to change the stockpile letter if they moved to a different pile.

 

In the spreadsheet I attached, I have already tried breaking out the pulldata calculation into the ${last stockpile} field, which works on its own, but when I feed that into the default and calculation fields for ${Stockpile_Letter} it still does not work. I agree the pulldata calc seems to fire off before the search, it would be nice if there were a way to force the program to run the calc after the search.

 

Let me know if any other ideas come to mind.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Are you trying to use the calculation field to set the items the user sees in the list?  If so that is not how the calculation column works - it is used to set what values are selected.   Search should be the one the changes the list options.  Sorry I am lost here still.  I get what you are trying to do just not sure why you have both search and pulldata.

0 Kudos
Ford_Rundell
New Contributor II

I am using the search() appearance to set the list of options, and pulldata() to set the default/autofill value from that list of options, based on the user's last submitted survey.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Ok that makes sense then.  I think the order is off.  Is there i way you can add a relevant. So it does the pulldata then the field comes on?  That way you can control the order.

0 Kudos