Need to make calculations using objectid

787
8
06-24-2022 04:22 PM
AJ_devaccount
Occasional Contributor

By creating an objectid field with a null field type, I was able to publish the form without getting any errors. And any calculations I use on objid_waypoint shows up in the Sent folder in the field app.

AJ_devaccount_0-1656112269818.png

The problem is that the objid_waypoint is blank in the Survey123 online database. The only way to get the calculations is to recalculate it on the edit mode on the data tab, that's how I got the 1 and 2 values to show up. 

AJ_devaccount_1-1656112608759.png

But recalculating all submissions online using the edit mode will take a long time. Is there a way to recalculate all submissions? I just need to recalculate the one objid_waypoint field. 

Or is there another way to have a field with objectid calculations? I don't want to edit the objectid itself, just use it for calculations.

 

Tags (1)
0 Kudos
8 Replies
ZacharySutherby
Esri Regular Contributor

Hello @AJ_devaccount

If you just need to update the objid_waypoint field you can field calculate it using an Arcade function. 

ZacharySutherby_0-1656114222432.png

If you have subsequent calculations based on the objid_waypoint field they will need to be updated in Survey123 by editing the record. 

Thank you,
Zach
AJ_devaccount
Occasional Contributor

Thanks @ZacharySutherby, I do need the field crew to be able to see the objid_waypoint in the field app. So would the best way be to include the calculations in the XLSForm so that it'll show up in the Sent folder. And to bulk calculate the objid_waypoint in AGOL using arcade?

0 Kudos
DougBrowning
MVP Esteemed Contributor

Records do not get ObjectIDs until they are uploaded to AGOL is why.  It will never have them when in 123.  It makes sense since there could be hundreds of tablets all collecting data at the same time.  No way to have all those devices know what ObjectID to use next.  

I would ask why do you need this?  I cannot think of a reason really.  If you are trying to someone number in a repeat you could try position but it can get funky when items are deleted in the repeat then more are added.  Say you have 5 items and delete item 3.  Then add a new one that will be 5 also.  123 uses globalid and objectid to keep these all connected.   Also on export objectids may be recalced.  Not a good way to go.

What are you trying to use this for and that may help us come up with an idea.

0 Kudos
AJ_devaccount
Occasional Contributor

Thanks @DougBrowning, our ecologists are collecting point locations for various field operations (they might use it offline as well when there's no service). They want the waypoint format (they'll also record this on their paper sheets in the field) to be autoincrementing number that goes back to 001 when it reaches 999. 

From my research Survey123 doesn't allow autoincrementing numbers. I saw a post about calculating it on repeats, but I need a sequential number for each new survey submission. From my testing, calculations can be done on object ID and they'll show up in the Sent Folder (users aren't allowed to resend or edit their records, so object id won't change that way). I'm thinking for offline use, they'll have to record the waypoints after they're online and have sent their submissions.

I'm not sure if there's a better way to do this, but certainly open to any other methods.

Thanks!

0 Kudos
DougBrowning
MVP Esteemed Contributor

With all those people offline there is no way to get sequential numbers.  I would rethink your workflow really.  Trying to use a modern form plus also still paper gets super tricky.  Objectid could not start back at 999 either.   Generating some other type of code would be better.  Or add whatever is on paper to the form.  

Sorry hard to tell here.  But with many tablets offline sequential is just not going to work.

0 Kudos
AJ_devaccount
Occasional Contributor

Thanks @DougBrowning, we're slowly working towards transitioning out of paper records, and this is more of a stop gap measure. Just for reference, could you let me know when you noticed the object id changes?

0 Kudos
DougBrowning
MVP Esteemed Contributor

Mostly feature class to feature class tool I think.  Certain exports not sure.  They also may not always be continuous if someone else is also uploading at the same time.  For example 2 tablets both uploading to AGOL at the same time.  It could be the first tablet uploads 5 records getting 5-10, then tablet 2 has 3 upload getting 10-13, then tablet 1 keeps going and gets 13-18, etc.  

In general counting on ObjectID like this never really works out.  I would think of another way to generate and id.

AJ_devaccount
Occasional Contributor

@DougBrowning would you know when object id changes while importing/exporting? I could perhaps try to prevent it from changing if I knew when it does that. Thanks again for your help

0 Kudos