This is my contribution to notify to an user (if not using survey123 in disconnected mode) than the form needs to be reload.
How it‘s working:
You publish a table in AGOL with a field contained the version info (VAL_VERSION), each time you open the form in the field survey123 a function *js send and ID, retrieve the version and the calculation perform the comparison
This example uses a javasript function to send and ID and retrieve the version
What you need:
- The javascript code in the zip (contain, the *.xls and the *.js function)
- Create a reference table or a feature service hosted in AGOL( don't forget to share the table to the same group using yours Survey123)
- The url of the reference table to retrieve the official value. The table is publish in AGOL. I provide a example of the table, see the cvs to create the table on AGOL.
- Add an folder named "extensions" in the survey123 project containing the *.js.
Note :To make the JS functioning, each time you modify this the *.js file you need to close and reopen the survey123 connect app
Detail:
All the configuration are done from the xls
This is the detail of the values in the XLS ant in the JS function :
Javascript function:
function QueryFeatureLayerByField(featureLayer,Queryfield,Value,outFields,token,debugmode)
Pulldata *.xls:
pulldata("@javascript","myFunctionsFR_Demo.js","QueryFeatureLayerByField",${myURLversion},"ID",string(${ID_version}),"*",pulldata("@property","token"),true)
variable in the function *.js | values | pulldata correspondance | details |
featureLayer | "https..../0" | ${myURLversion} | table's URL |
Queryfield | ID | "ID" | the ID field for the query |
Value | 1 | string(${ID_version}) | the value to retrieve in the query , ID = 1 |
outFields | * | "*" | fied retrieve from the query. ou can choose all the field * or a specific field “VAL_VERSION” |
Survey123 connect:
Result:
Exemple of the table:
This method could be also use to retrieve other info (from the survey himself, past summit ) to populate default value info.
thanks for the *.js code and the idea to @Chelsea Rozek for the post Force update to new survey
and the post https://community.esri.com/message/823053-pulldata-json-to-query-feature-service-with-token
Demo_Retrieve_Version_from_FS_with_JS.zip