We have a field map that has a number of date / time attributes.
If I change the current inspection date / time, how do I get the previous date / time to be the replaced by the old current date / time automatically?
Solved! Go to Solution.
Assuming you're creating and updating the same feature (not related records) you can you $originalFeature on Update. $originalFeature contains the attribute values as they were last submitted to the database.
In this example I created two fields and added a form calculation to the the_previous_date field.
Example: Using $originalFeature to access attributes from the previous form submission
// check the editType becuase $originalFeature isn't applicable on INSERT
if ($editcontext.editType == 'UPDATE') {
if (!IsEmpty($originalFeature.the_current_date)) {
return $originalFeature.the_current_date;
};
// no previous inspection if current inspection date is null
};
// no previous inspection date on INSERT (new inspection)
And here is what it looks like:
I guess it might be possible to achieve what you want with Arcade but a better option would be to use a related table to store the inspections. Then you can easily keep the whole history of inspections in that table. Here is the first in a series of six videos outlining how to achieve this: Inspection Workflows Part 1: Building & Publishing Related Tables - YouTube
Assuming you're creating and updating the same feature (not related records) you can you $originalFeature on Update. $originalFeature contains the attribute values as they were last submitted to the database.
In this example I created two fields and added a form calculation to the the_previous_date field.
Example: Using $originalFeature to access attributes from the previous form submission
// check the editType becuase $originalFeature isn't applicable on INSERT
if ($editcontext.editType == 'UPDATE') {
if (!IsEmpty($originalFeature.the_current_date)) {
return $originalFeature.the_current_date;
};
// no previous inspection if current inspection date is null
};
// no previous inspection date on INSERT (new inspection)
And here is what it looks like:
Thanks @JustinReynolds , I appreciate you taking the time to assist with this 🙂