Once function interrupts concat

609
3
11-30-2023 12:38 PM
NickAddison
New Contributor III

So I have a survey, wherein hydrant data is being recorded. I need new asset id's to be assigned and not changed during future edits, which is why I added once(). I'd also like for the instance name to be based on the asset id + short address (just placed it in the survey and not the settings for ease of testing, I know I'll need to move it).

However, after I added the once() function to the asset id calculation, the concat would no longer pull the fire_district_abrev (ex. -20232230-1535). If I remove the once() function the concat works as intended (ex. WBD-20232230-1535), but now a new asset id is assigned when edited.

Where am I going wrong?

 

TypeNameCalculation
textasset_idonce(concat(${fire_district_abrev}, format-date(now(), '-%Y%m%d-%H%M')))
textinbox_idconcat(${asset_id}, " - ", ${short_address})
textfire_district_abrevpulldata("@layer", "getValueAt", "attributes.FireDistrictAbrev", "url", ${hydrant_location})

 

 

Tags (3)
0 Kudos
3 Replies
NickAddison
New Contributor III

As a work around, if I set readonly to null for both, and remove the once() function on the asset_id, then upon viewing or editing the data the asset_id and inbox_id will remain as the original value, but are open to user edits (definitely not preferred). 

Unfortunately, if I set readonly to yes, and remove the once() function, it locks it from user edits during viewing or editing, but assigns a new asset_id and inbox_id. 

Still exploring the issues and solutions though. 

0 Kudos
NickAddison
New Contributor III

Still not satisfied with the workaround. Elsewhere, someone recommended to try calculationMode=whenEmpty. After several permeations of readonly and calculationMode=whenEmpty with various calculations none working as wanted. The workaround works but isn't preferred since it leaves it open to edits.

0 Kudos
MarikaVertzonis
Esri Regular Contributor

I can see you have made a lot of tests in the attached spreadsheet. It appears to me that the combination that best suits your stated requirement is test_4_1 (ie: readonly=yes, expression without the once, and calculationMode=whenEmpty). what is it about that combination that doesn't work for you?

0 Kudos