I am relatively new to Arcade and trying to wrap my head around this, if it's even possible. I have a point layer (Catch Basins) that contains a related table (Inspection Table) for my users to input a new record each time a catch basin is worked on using Field Maps.
I'm wondering if there's a way to send a value from the input form (which is currently on the Inspection Table) to the point layer to dynamically update the Current Condition field of the point layer with a calculated expression in Field Maps Forms. I would like to symbolize by this field on our maintenance Web Map so we can immediately see where the current condition is Poor or worse.
So to be clear, users are creating data on a tablet using Field Maps in the Inspection Table, but I'm trying to send the reported condition field to the Point Layer when that information is submitted by the user on the tablet form for the related table.
Here's what I have so far. I've used a filter to match the AssetID values of the point and related table records, and then successfully stored the most recent condition information into an array. I just don't know how to push it to the point layer field "CurrentConditionTemp".
//Define related table assetID
var AssetIDInspectionTable = Text($feature.AssetIDInsp)
//Define related table featureset to sort by date and condition later
var InspectionTableSet = $featureset
//Define Asset ID and field to populate point
var CatchBasinPoint = FeatureSetByRelationshipName($feature, "Collection_Backward",['ASSETID','CurrentConditionTemp'])
//Create filter to match AssetIDs
var FilterMatch = (Filter(CatchBasinPoint, 'ASSETID = @AssetIDInspectionTable'))
//Define empty feature array and Output object to populate output
var ConditionArray = [];
var Output;
//Iterate over inspection table
for (var f in FilterMatch){
//Sort by inspection date
var recentInsp = First(OrderBy(InspectionTableSet, 'Date_Authorized DESC'))
var latestCondition = recentInsp['Condtion_Insp']
//Push latestCondition into output object
Push(ConditionArray, latestCondition)
}
I've used a similar setup in PopUp configuration to pull related table info into the point layer, but that doesn't allow me to symbolize. Unless there IS a way to symbolize by PopUp, in which case I'd love to learn how to do that because it would solve this issue.
How do I send the "latestCondition" value from the table to replace the "CurrentConditionTemp" field in the point layer?
The reason this is not firing is that they are not editing the parent. The form of the parent never opens so its not going to run. A attribute rule may do it but those are not in AGOL yet. I do not think I have seen a way to edit a layer you are not in at the time which makes sense.
Two older school options I have used.
Run a python script on a schedule to check for new inspections and then update the parent field.
Or what I like to do is just make the related table a related feature class. Then you can just map the inspections themselves. This is also handy for times when crews mislabel the inspections as you can clearly see where they actually were standing. Many benefits to always grabbing spatial info, no real advantage to having it be a table. But if you already deployed this as a table it would take some work to change that.
Hope that helps
Darn, I was worried about that. I didn't think it was possible, but I knew I was close.
How do you run a python script on a schedule for hosted online layers? I didn't know that was possible.
We don't really want to use a separate feature class, that's actually how it was setup until 2 weeks ago and it's an absolute mess. The maintenance crews were not placing points correctly so it's impossible to see what goes to what spatially. They visit the basins multiple times a year so it gets crazy quickly. This solution I've been developing is intended to replace that. The benefit of a table only is it doesn't muddy the web maps, and we only need to send off a CSV for permitting every year anyway.
I've been using joined view layers overlayed on the master point layer as the solution to my problem, but you can't update data schemas or forms at all without completely deleting those, then remaking them later and it's a small pain point. I don't mind using those long term if it's the easiest way though. The maintenance supers use the "Schedule Repair" symbology to develop work plans for their people.
I think you can schedule notebooks right in AGOL now. I tend to use batch files on a server still.