Best way/place to perform this calculation

644
8
05-11-2022 09:25 AM
JasonCyphers
Occasional Contributor III

We perform inspections, where uncorrected and corrected gas meter readings are obtained.

To verify the readings are accurate, a formula is manually performed:

((a - b) x pfactor) + c

  • a = this month's uncorrected meter reading
  • b = last month’s uncorrected meter reading
  • pfactor = Positive Displacement Factor (a variable based on the pressure at the time of the inspection - a different number for every 0.5psi change in pressure)
  • c = last month’s corrected meter reading

What’s the best way and location to perform this calculation automatically?

Thought about Survey123, but don’t have a way to bring in last month’s reading.

Thought about a Dashboard, but can’t do complex calculations like that in Enterprise Portal.

Thought about an arcade expression in a feature pop-up on a map, but would be very time consuming to click on each point inspected during the month to verify readings.

Suggestions?

0 Kudos
8 Replies
berniejconnors
Occasional Contributor III

What are you using for an RDBMS?  I am not a DBA but you can define triggers in your RDBMS to do calculations - https://docs.oracle.com/cd/B13789_01/appdev.101/b10795/adfns_tr.htm

0 Kudos
JasonCyphers
Occasional Contributor III

It's a hosted feature layer within our Enterprise Portal consisting of point features & related tables.  The inspections are being performed on the related tables.

0 Kudos
berniejconnors
Occasional Contributor III

Triggers in Portal are called webhooks but the documentation does not list a trigger for updating a value in the related table - https://enterprise.arcgis.com/en/portal/latest/administer/windows/create-and-manage-webhooks.htm

 

0 Kudos
jcarlson
MVP Esteemed Contributor

What version of Portal are you working with? With the recent addition of data expressions, this kind of thing would be absolutely doable in a dashboard.

- Josh Carlson
Kendall County GIS
0 Kudos
JasonCyphers
Occasional Contributor III

10.8.1; so, no data expression capability.

0 Kudos
jcarlson
MVP Esteemed Contributor

Well, nuts. Next best thing is to create a new field to hold the calculation and have a small Python script to update the field on a regular basis. It's usually pretty simple, but referencing related tables could make things a bit more involved. Would something like that work for you?

Any chance there's a public view of the layer?

- Josh Carlson
Kendall County GIS
0 Kudos
JasonCyphers
Occasional Contributor III

No public view of the data, but an example would be:

Last Month's Readings:

  • Uncorrected Reading = 337,374
  • Corrected Reading = 500,610

This Month's Readings:

  • Uncorrected Reading =342,985
  • Corrected Reading = 527,239
  • pFactor = 4.745

Calculation to verify this month's Corrected Reading is accurate (or close to it):

((341,985 - 337,374) x 4.745) + 500,610 = 527,234 (which is close to this month's corrected reading of 527,239)

 

0 Kudos
JasonCyphers
Occasional Contributor III

Was able to pull data from the related table into the feature's pop-up using the code in this blog.

In talking with the end user, they would be ok with having a calculation performed within this pop-up, enabling them to click on each site to see the calculation results.

I'm a novice when it comes to arcade expressions (I can usually figure them out once I have one, tweaking it to suite my data) - any assistance on what an arcade expression would be to perform my calculation within the feature's pop-up? 

0 Kudos