Select to view content in your preferred language

Manually Entered Data in Survey Start Date Field

497
2
04-17-2024 06:53 AM
Dani_Interrante
Occasional Contributor

Hello,

We are trying to set up a Survey 123 based app where users will enter their data in a Survey form embedded in an Experience Builder App.  The Survey 123 components are being built in Survey 123 Connect.  The users will be able to edit their entries in a survey form in that same app.  One critical component to this app is creating and maintaining a unique id that stays the same throughout the lifespan of the record, even if it's edited.  This unique id is generated through a javascript function on a calculated field.  This is a tricky process since every time the record is edited, all the calculated fields are recalculated, which causes the unique id function to rerun.  I found a workaround for new surveys where I can use the datetime stamp in the survey start field to feed into a javascript function and write the logic to keep the same unique id if a record with that same timestamp already exists.  

 

The kicker is that I am trying to import data from another system into this for already open cases.  For these imported records I'm manually entering the date into the survey start field directly on the feature service.  What I'm finding is that the XML field calculations cannot read the manually entered dates on the survey start field.  It can read other manually entered dates on other date fields and it can read the dates autogenerated by Survey 123, but not the dates on these imported records.  I had been operating on the assumption that the system would be agnostic to how the date data got inputted into the start survey field on the feature service, but apparently that's not true.  Does anyone have any ideas on how to manipulate this data to achieve the same response?

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor
0 Kudos
Dani_Interrante
Occasional Contributor

Thanks for linking this Doug, I had not stumbled upon this.  Unfortunately, we are trying to do this in a web app not a field app so these parameters don't work in this instance (we tried and got new errors).  We're currently trying to configure a url within the experience builder that passes the existing calculated field value back into itself.  (Based off this article: Survey123 Tricks of the Trade: Web form URL parame... - Esri Community).  We think we're onto something there, however the passing of the value of the calculated field back to itself seems to cause the url to fail.  In this example calculated_field is the field we're concerned about and text_field is a separate text field we're testing the url parameters on. Currently we input mode=edit&globalId= {GlobalID}&field:text_field=Test Text, we get the expected result with the desired record opening and the string "Test Text" inputted into the field.  When we switch to mode=edit&globalId= {GlobalID}&field:calculated_field={calculated_field} the survey opens up to a blank survey with nothing inputted.  Any insight on that behavior?    

 

Edit: I was incorrect, when attempting to pass any value back to an existing survey via mode=edit&globalId= {GlobalID}&field:calculated_field={calculated_field}, the survey breaks no matter what field or value we place into the field parameter.  Is it possible to open an existing survey entry in edit mode with some of the parameters being passed back to it via field?

0 Kudos