Hi All -
I have a collector inspection app that needs to calculate a 3rd field. It's not vital that the 3rd field is calculated in the field however the 3rd field does need to be seen if the asset is revisited.
To simplify I have a table in a relationship class with the fields:
Field1, Field2 and Field3.
(Basically this was built following Jeff's Hydrant example)
Worker collects values: Field1 = 250 and Field2 = 50. Field3 is NOT collected (Field3 = 0)
Worker returns to office performs a sync, I setup an update trigger within SQL database that calculates Field3 = Field1- Field2 (in this example Field3 = 200)
When the data is viewed in Portal I see all the fields with correct data values.
The problem that I'm seeing is that the data(inspection record) on the device doesn't get updated to show that Field3 = 200.
The only way (at the moment) to see the updated values is if I removed the collector app and reload it on the device.
There has to be a way to see the updated values after my trigger is executed. But I don't know how to "push" it back to the device.
Anybody have any ideas?
Do you cache/resync the device after the field is calculated and updated in portal?
Hi Matthew -
Thanks for the quick response.
If by cache/resync you mean tapping 'SYNC' again on the main collector page, the answer is yes and the field is not updated. I have even added new inspection and all the records are not showing the update. I have also tapped 'refresh' from the menu and that doesn't update the records either. The only way I can see the updated Field3 (per my example) is by removing the app (i.e. manage>remove) then loading the app again. Which is an unacceptable workflow.
did you verify that geodatabase versioning isn't causing the behaviour you are seeing? In case this is versioned data, do you reconcile the data from the base table (where your SQL trigger updates Field3) with the version that Collector Sync's to&from before tapping 'Sync' in Collector?
Just an idea: Editing nonversioned geodatabase data in SQL Server using SQL—Help | ArcGIS for Desktop: "If the nonversioned table you want to edit using SQL is enabled for archiving, you must edit the table's archive view rather than the table itself."
Very interesting. I have to say this article lead me to an error in my trigger. I was incorrectly using the OBJECTID within my update trigger and it recalculated all the inspections for an asset, which populated previous inspections with incorrect values.
Most recent inspection 250 - 25 => Field3 = 225
Previous inspection 250 - 50 => Field3 = 200...however it was recalculated to 225 because the OBJECTID is the same. By changing my code to use GDB_ACHIEVE_OID I was able to preserve previous inspections.
However the updated FIELD3 still won't show up on the device.
Regardless that article helped to some degree, thanks.
Does collector work differently with data stored in a SQL database than say ArcMap or a webmap in portal does?
I have triggers set up on my SQL database (both in the table and view trigger folders) that fire when I do updates via ArcMap and through Portal but I can't get those triggers to fire when I make changes/updates using collector.
My suspicion is that both ArcMap and Portal work on the 'table' and collector is working on the 'view' but I can't seem to confirm this. If I understood the logic on how Collector worked with the SQL database, I might be able to solve my problem.
Thanks for you time