Select to view content in your preferred language

Strange attribute rule behaviour

72
2
yesterday
CarstenAndersson
Regular Contributor

I have a feature service that points to a feature class called StopPoints ("Stoppunkter" in Danish) in a SDE database (SQL Server).  The feature class has an immediate attribute rule, that gets the next value from a database sequence and sets it to a field called BusinessKey ("Nummer" in Danish), if it isn't already set to a value.

The attribute rule looks like so:

 

if (IsEmpty($feature.BusinessKey) || $feature.BusinessKey == 0) {
    return NextSequenceValue("S_STOPPOINT_BUSINESSKEY")
}
return $feature.BusinessKey

 

This rule is triggered by Insert. I have checked Exclude by application evaluation. Directly after I've created the feature I query the table using SQL Server Management Studio, and I can see that the newly created row has the BusinessKey set to the next sequence value.

But for some reason, sometimes the BusinessKey is zero in the attribute pane and other times it's the value from the sequence. It seems like the number of layers has something to do with it, but I don't understand why that should be the case.

In this example the BusinessKey (Nummer) is zero:

CarstenAndersson_0-1740651064304.png

The feature service looks like so:

CarstenAndersson_1-1740651095128.png

In this case the BusinessKey is not zero:

CarstenAndersson_2-1740652010612.png

And the feature service has these layers now:

CarstenAndersson_3-1740652310053.png

It is worth mentioning that the two layers I removed has no attribute rules, triggers or any kind of calculation.

I don't understand this, so any help is greatly appreciated 🙂

0 Kudos
2 Replies
CarstenAndersson
Regular Contributor

And as I mentioned, even though it sometimes looks like the BusinessKey is zero

CarstenAndersson_0-1740659515849.png

It's actually another value in the table in the SQL database

CarstenAndersson_1-1740659613172.png

0 Kudos
GeeteshSingh07
Frequent Contributor

@CarstenAndersson By any chance, does 'Nummer' field have any default value set in ArcGIS Pro? 
If assigning sequence fails, it should have given <Null>; however, it is giving zero.

You can also check this out:

BUG-000124487: An immediate calculation rule calling a database sequence using the NextSequenceValue() function in ArcGIS Arcade only works for the schema owner of the database sequence and fails for other database users.

BUG-000124487 for ArcGIS Pro

0 Kudos