I have a related table and a line feature layer in AGOL. I am trying to create a form in Field Maps that automatically calculates the latest record from the related table and populates it into a comparable field in the line feature layer.
I tried writing a script in Arcade that would read the feature attribute "DelitterRoundNumber" from the table and then calculate it in the form for "Delitter Round" in the feature layer:
Context: I am setting up a Delittering Field Map for a refuse department. The laborers who will collect litter at designated locations will collect attributes including what Round Number they are on. When the laborers collect for a specific round number (i.e. 1-5) that round number will be auto populated or calculated into the "Round Number" attriubte of the line feature layer.
I could be wrong, but I think the "Calculated value" code only runs when the form first opens. So at the time the code is looking at the field in the related table, it is probably an empty field....correct??
You could try setting a default value for that field, and then see if your code works to at least start figuring out what is happening.
That was a good idea, and I did try and set a default value for the related table, but it led to an additional error in field maps "Unable to calculate field".