How to Update Collected Data on Device

3109
7
12-22-2015 11:42 AM
ThomasHasselbeck
New Contributor III

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?

Thanks

Tom

Tags (1)
0 Kudos
7 Replies
MatthewBaber
Esri Contributor

Hi Thomas,

Do you cache/resync the device after the field is calculated and updated in portal?

0 Kudos
ThomasHasselbeck
New Contributor III

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.

Thanks

Tom

0 Kudos
TobiasFimpel1
Occasional Contributor III

Thomas,

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?

0 Kudos
ThomasHasselbeck
New Contributor III

Tobias -

Data was prepare per these instructions here​.

To be clear: versioning is disabled.

Thanks

Tom

0 Kudos
TobiasFimpel1
Occasional Contributor III

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."

0 Kudos
ThomasHasselbeck
New Contributor III

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.

i.e.

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.

0 Kudos
ThomasHasselbeck
New Contributor III

Matthew -

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

Tom

0 Kudos