Attribute Calculation Rule - Automate Sequence Value

103
0
02-14-2022 02:26 PM
Jcronce
New Contributor

I have a file geodatabase with a point feature class and a standalone table. The standalone table is linked to the point feature class via a relationship class. The relationship class is using GUIDs as a one to many relationship. I'm trying develop a Calculation Attribute rule where the next value in FIELD1 is increased by 1. Due to the relationship class, I'm unable to use the Sequential Numbers concept. Here's my example:

Point Feature Class: Measurement Location (Plot)

Standalone Table: Trees 

There are potentially many Trees within a Plot.

The plot location is predetermined with a GUID as the unique ID.

I would like the user to click a plot and add a tree beginning with number 1. The next plot will also begin with number 1. 

Is there a way to use the Calculation Rule to auto populate this attribute?

I am new to Arcade and here's my attempt.

var filt_val = $feature.PlotsGUID
var fs = FeatureSetByName($datastore, "std_Trees", ["PlotsGUID", "intTreeNum"], false)
var list = Filter(fs, 'PlotsGUID = @filt_val)
var TreeCount = 0
var TreeCount = Count(list)

IIf(TreeCount == 0, 1, TreeCount + 1);
return TreeCount

 The issue is that filt_val variable is not storing the PlotsGUID value when adding a new record in the standalone table.

Any help would be very much appreciated.

0 Kudos
0 Replies