Select to view content in your preferred language

Calculated expressions evaluating on previous record

408
0
08-28-2023 01:16 PM
EdwardMcFarlin
New Contributor II

I am trying to implement some calculated expressions in a form to track the user that added a new feature. The problem I am running into is that the expression seems to evaluate on a previously selected record, not the currently selected record. This is happening in both Map Viewer and Experience Builder (I should note that I do NOT have this issue in Field Maps using the same expression). For example, when I first open the MV or EB map I will load a new feature which will calculate my username in the "loaded by" field. If I then go to edit an existing feature, it will then calculate my username, not the existing username that is already populated. The same issue will happen were I to edit an existing feature and then edit another existing feature -- the calculated expression will return the value from the previous record. If I were to then try to load a new feature, again the calculated expression returns the value from the previous selection, not my username. The only way to get the correct value to be calculated is to refresh the browser after every single edit in EB or refresh the browser or close and reopen the edit tool in MV or do some other complicated selecting and unselecting of features from different layers to seemingly release the values from the previously selected record.

This is the arcade expression I am using:

 

IIF($editcontext.editType == 'INSERT', GetUser(Portal('https://myportal.myorg.org/portal')).username, $originalFeature.LoadedBy)

 

 

0 Kudos
0 Replies