Arcade Expression - "Last_Value" Attribute Assistant Method

1489
3
03-12-2021 12:31 PM
by Anonymous User
Not applicable

I'm trying to write an arcade expression that will grab the last value used in a field and populate that same field on creation of a new record.  Also to have the rule only "fire" if the new record and its target field is saved on creation as null.

Basically a "translation" of the Attribute Assistant Method Last_Value into Attribute Rules.  I'm assuming there will be some use of loops, but honestly I just need some nudging in the right direction and help on how to construct this expression.

0 Kudos
3 Replies
JoeBorgione
MVP Emeritus

So your last value is a numeric value and when you add a new feature, you want that field to be last value + 1.  Is that correct?

If so, my suggestion is to use a data base sequence and start your sequence with the highest current value. You can then add  a rule to return the next value of the the sequence.

That should just about do it....
0 Kudos
by Anonymous User
Not applicable

No, not looking for database sequences.  Totally good on that - generating IDs and all.

I'm talking about having a record on, say, a hydrant layer.  That I created yesterday.  All the fields are populated.    And then today I'm adding a new record and I want the Owner field to automatically grab the value of that record I made yesterday.  (So, the "last value" that had been entered in that field before my new record).

Appreciate any insights!

0 Kudos
JoeBorgione
MVP Emeritus

Ahhh.  I see...

Take a look here ; I see that last value currently does not have an attribute rule counter part.

That should just about do it....