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})
In other words, I need to get values for the survey that are persisted in storage before the existing survey gets opened in Survey123.
TIA
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.
Regards,
Phil.