Select to view content in your preferred language

On Inserting a new record, populate past measurement

181
2
04-14-2025 09:38 AM
JessicaShue
Occasional Contributor

Hi, I am attempting to collect repeated inspection data for the first time. I have a tree feature class with a related table of measurements. We have equipment installed on each tree that will be re-measured biweekly.

I would like to:

1. Pull the previous measurement entered into the related table the week before into a field of the related table to perform a calculation check. (There is a 'measure' field and a 'prevMeasure' field).

2. Create an alert for the field crew to real-time 'see' that a measurement is out of range. (There is a 'measurementCheck') field.

I have found all sort of documentation to extract a value from the related table to the Parent feature class and can successfully show those values in a text box on the feature class pop-up.

It doesn't seem that you can use $editcontext.editType == 'INSERT' to return the $originalFeature on a related table.

It would be really helpful to show the field crew if there is a measurement error immediately. Is there a way to pull in a past measurement to the new record of a related table? I have tried the code below, and the value does return when running it in Field Maps Designer, but the app freezes when I attempt to 'Add' a new record to the related table...

var prevData = OrderBy(FeatureSetByName($datastore, "1", ['measureDate', "prevMeasure"], false), "measureDate DESC")
var f = First(prevData)
Console(f)
return f.prevMeasure

 

Thank you!

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

I would use FeatureSetByRelationshipName instead.  Here you are just giving it the name 1 which I doubt its called that.  I am also not sure if a calculated value fires right away or on submit.  You can use just a note field to display it as well. 

0 Kudos
JessicaShue
Occasional Contributor

Thanks @DougBrowning. When writing Arcade code, I do tend to rely on the 'Profile Variables' and 'Functions' help on the right-hand side of the Arcade window. When I look under $datastore, for 'FeatureSetByID' it does list my related table as "1"; but as I'm not using 'ByID' maybe that isn't the correct thing to use.

I'm having a bit of trouble with the website this afternoon, may be the internet at my work. I will try to test things out again in the morning. I know you respond to a lot of these questions, so thank you very much!

 

 

0 Kudos