Attribute Rule Validation Trouble

246
0
10-05-2021 12:06 PM
Labels (1)
JCGuarneri
Occasional Contributor

I'm trying to set up a calculation attribute rule to populate a general ledger account value based on the contents of some text fields, and I'm running into trouble with validating the rule. My Arcade script works when I run it as a field calculation, as a popup calculation, and even validates in the Expression Builder in the attribute rule setup. When I go to save the rule, I get an error of 002717: Invalid Arcade expression, Arcade error: String type expected, Script line 39 (that's line 18 in the code snippet below). Is this a bug, or is there something I'm doing wrong here? I'm using ArcGIS Pro version 2.8.3.

My code is basically the following. I've shortened the dict and redacted accounts, but you get the idea.

 

 

//lookup dictionary for account numbers
var accountDict = {
'DISTNonUnionSUV' : '######-####-###',
'DISTNonUnionVan' : '######-####-###',
'DISTNonUnionTruck' : '######-####-###',
'DISTUnionBackhoe' : '######-####-###'
};

//collect values from fields
var vehDept = $feature.Department;
var vehClass = $feature.Class;
var unionStatus = $feature.VehicleType;

//concatenate values to generate key
var accountType = vehDept + unionStatus + vehClass;

//retrieve and return GL Account
var accountNum = accountDict[accountType];
return accountNum;

 

 

 

And proof that it's validating in the expression builder:

JCGuarneri_0-1633460721954.png

 

Tags (2)
0 Replies