I'm dead in the water if I can't somehow create a "virtual column".

3191
19
07-20-2016 09:14 AM
RoyceSimpson
Occasional Contributor III

I have a point feature class that has two numeric columns that my field workers will populate.  I need to somehow have third column auto-populate based on a math formula between those first two columns.  In the days of "the coverage" you could do this via a "virtual column" or "derived field".  Seems that this is not possible in the GDB.  FAQ: Are Computed/Virtual columns supported in an Enterprise environment in ArcGIS?

Is there any way to do this?  I can't imagine that the only way is to manually go in and use the "field calculator" or jimmy up some sort of scheduled python script.  That just doesn't make any practical sense as my field workers will be in and out all day, days on end and our reporting needs to have that third field up-to-date at all times.  What am I missing here?  We are in the 21st century right?   (I kid, but I'm frustrated).

Thanks, Royce

0 Kudos
19 Replies
RoyceSimpson
Occasional Contributor III

Attribute Assistant won't work. 

That requires a person to be in Arcmap to run the tool.

Any other ideas?

0 Kudos
TanyaHaddad
New Contributor III

This is a bit clunky, but what if your column C contained a URL that the user would click and that resulted in a pop-up that showed the calculated amount with some formatting and context for meaning?

The URL would only need to have the ID of the row, and the script in the pop-up would contain the calculation from column A and B.

0 Kudos
RoyceSimpson
Occasional Contributor III

Tanya.  I'm actually starting to think that route as well.  Something like building a geoprocessing service that has the calculation built in and the result is the value we need.  Then make a button the desktop that the user would click and a web page pops up with that result.  Ugh.  That's just super clunky (as you say), inelegant to the extreme and just plain sad that there is zero way to get this to work natively within "the platform".  I've asked our esri rep and other folks and am shocked that this isn't an issue that GIS folks run into every day.  There are so many cases where you have people collecting data but that data isn't usable until some formulas and such are run against it.  To rely on manual field calculations to achieve that just seems dodgy as all get out.

0 Kudos
RoyceSimpson
Occasional Contributor III

Here's the other option we are looking at.  Just add this "columnC" to the point feature class and have one of us GIS people on the hook to calc that field whenever our customer needs it calculated... which could be multiple times a day for weeks on end.  Yay!   Simple, totally dumb but.. simple.

0 Kudos
RoyceSimpson
Occasional Contributor III

And yet another option... GeoEvent Processor.  Could perhaps rig up a trigger such that every time data comes in via the feature service, run a calc on that columnC.  Not sure if GeoEvent Processor does that sort of thing but I guess it's worth investigating.

0 Kudos
TanyaHaddad
New Contributor III

If this problem is primarily caused by the GDB format, another idea to look into is to use an alternate file format such as GeoPackage.

GeoPackage is supported in ArcMap 10.2 and up [2], and is based on SQLite [1] and it is likely that an "auto calculate" field will work in that file format [3] [4]

[1] OGC GeoPackage

[2] Support for OGC GeoPackages in ArcGIS. | ArcGIS Blog

[3] Does sqlite support a trigger to automatically update a field? - Stack Overflow

[4] SQLite Query Language: CREATE TRIGGER

RoyceSimpson
Occasional Contributor III

I've got one other possible play here.  My DBA has created an Oracle trigger that will update columnc with the derived value from columns A and B.  In Arcmap at least, things look good.  I can update either or both of columns A and/or B and Column C automagically reflects the update and math formula.

Will update here with the results.

0 Kudos
CarlosSousaFerreira
New Contributor III

I believe the trigger is the way to go, but you still have the option to create a Materialized View in Oracle, that can contain the spatial data as well and you can work with it as a regular layer in ArcMap or create a web map service based on it. The Materialized View will be updated whenever you settle it to be (ex.: every night at 10pm).

But if you want to be able to see the changes almost immediately after any update, I believe the trigger is probably the best option.

0 Kudos
RoyceSimpson
Occasional Contributor III

The trigger seems to be the right solution.  I'm able to edit our point data (column A and B) in AGOL/Collector, then have a separate "viewer" AGOL web map that shows the calculated column C... works like a charm.  We are using an trigger  in Oracle to perform the formula calculation on Column C such that when Column A or B get updated with a new value, Column C is calculated and populated.

0 Kudos
Bud
by
Notable Contributor

I know this post is ancient, but I just thought I’d add:

In modern versions of ArcMap and ArcGIS Pro, it’s possible to register views with the GDB and publish those views as map services. 
My experience with views that have a calculated shape column is: ST_GEOMETRY views are slow, but SDO_GEOMETRY views are fast. Also, XY Event layers are surprisingly fast too.

Something that might be of interest to Oracle people: function-based spatial indexes. If you are a data creator/owner, then you would have the privilege to make regular Oracle indexes. And if you can make regular indexes, then that means you can make function-based indexes too (via a SQL client like SQL Developer, Toad, etc.).

0 Kudos