Select to view content in your preferred language

Pull data only if field is empty

630
3
10-03-2024 05:52 AM
KennethLindhardt1
Frequent Contributor

Hi, I'm in a corner I can't find a way out of.

I only found the issue because I needed to test the inbox.

So.

I'm pulling @layer and using pulldata to get the attribute

pulldata("@json",${pulledLayer},"attributes.my_attribute")

It works like a charm and writes the pulled data to the table.

When I need to update the collected survey, I get the issue that it pulls the data, and does not use the data that is already stored, how do I fix this, so if the the attribute is not empty, use that value, and if empty then  pull the data?

Thanks

0 Kudos
3 Replies
DougBrowning
MVP Esteemed Contributor

Have you tried calculationMode=whenEmpty?  I have heard varying success but worth a shot.

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-calculation-modes/... 

0 Kudos
KennethLindhardt1
Frequent Contributor

Thank you DougBrowning, It was so close,it actually did work, until I dug a bit deeper. One thing I didn't mention is that this is in a repeat. 
If I have one record in the repeat, I was getting the error when I opened it up through the inbox, on that first record. After adding the calculationMode=whenEmpty then it works on that first record, but adding a new one in the repeat, I then get the error on the second one where the data pulled is empty, it's not pulling in any new data. That is needed.

So I tested the same thing with the send folder, and that works out of the box, so that was strange.

I think the big issue is that it's in a repeat, since I'm doing the same thing outside of the repeat, wheres there no issue.

Let's say I want to edit a survey, and send it, then my information that is now not pulled disappear from the service. Not good!
Using calculationMode=whenEmpty I keep my old data, but new data is not able to be pulled, not good either.

Send box works like a charm, however we have multiple people who can do multiple registrations, actually over the next 10 years or so, so I don't think a send box would be very usefull.

Cheers

0 Kudos
DougBrowning
MVP Esteemed Contributor

Coming back from drafts or sent has caused us issues for years also.  Calcs do not work the same way.  I think inbox is similar.

You could try manual calc mode and tell the users to refresh it if its blank.  Or a 3 field option maybe.

For me with all these reasons we use one form per visit not one repeat per visit and it all works much better.

Good luck

0 Kudos