Populating an answer for an existing survey based on the value entered previously

06-30-2020 01:32 PM
Occasional Contributor II

I would like populate an answer for an existing survey based on the value entered previously when the survey was opened and edited before.

For example I have text box named mytime that uses a function to pre-populate the answer with the string "First Time" when the survey is created the first time.

Then, when the survey is opened subsequent times, the following pseudo-function get fired if(${PREVIOUS_VALUE_FOR_mytime} = "First Time", "Another Time" ,${PREVIOUS_VALUE_FOR_mytime})

  • value from first opening gets checked against "First Time" and either changes it to "Another Time" sets the initial value to "First Time"

In other words, I need to get values for the survey that are persisted in storage before the existing survey gets opened in Survey123.

  • Can this be done?
  • If yes, how? In particular, how do I "see" those persisted values to do things and make decisions with.


0 Kudos
1 Reply
Esri Notable Contributor

Hi Dirk,

This is not currently possibly using functions or expressions within the survey xls form. Data values from other surveys in the database on the device can not be queried, only values form within the same survey record.

That being said, it is now possible to use a JavaScript function, and the pulldata @ JavaScript syntax in that question and return a value from the feature service via the JS function that you can then use in an expression. It can not query the local database, but if the records have been sent, can query the feature service to get the value.

From 3.10 release, JS functions are now fully supported in both Connect, the field app and the web app.



0 Kudos