Hello,
I am trying to figure out how to write an arcade expression that will populate 1 field based off of the values in 4 other fields. I am using attribute rules and still very green to arcade expression. I would also like the attribute rules to work in field maps. When our field crews go out they will be filling in the 4 fields mentioned above and I am having trouble piecing this expression together.
Field Name to Auto Populate: serviceLineClassification
Field Names to Trigger Auto Populate
systemBasisOfClassification1
systemInstallationDateRange
customerBasisOfClassification1
customerInstallationDateRange
Note: All of the fields have domains connected to them. The expression I put together below is just the first of many as I need to cover all of the variables. However, I am having trouble getting the first expression together.
Expression I Tried:
if (DomainName($feature, 'systemBasisOfClassification1', 'A) Records Review', "n/a") == 'A) Records Review' && DomainName($feature, 'systeminstallationDateRange', 'n/a') == "L) 1991-2000', 'n/a')) {return DomainName($feature, 'serviceLineClassification', 'Non-Lead', 'n/a')}
Hope all of this makes sense and in advanced thanks to anyone who can help.
I dont have much experience with the DomainName function, but I often will run attribute rules on fields that have domains without using it and have no problems. One thing I see is that there might be some mismatched quotes (single vs double to encase a text string). I might be wrong but you could look at that.
var sysClass = $feature.systemBasisOfClassification1
var sysInst = $feature.systeminstallationDateRange
var c = WHEN(sysClass=='A) Records Review' && sysInst == 'L) 1991-2000','Non-Lead','UNKNOWN')
return c
You might be able to simplify a bit by using something like the above. You'd be able to add additional subsets of the WHEN function just by adjusting the values from your dataset.
The second DomainName appears to be incorrect. You have double quote before L but no closing double quote, no value, an extra 'n/a', and an extra parenthesis. Should that be like this?
if (DomainName($feature, "systemBasisOfClassification1", "A) Records Review", "n/a") == "A) Records Review" &&
DomainName($feature, "systeminstallationDateRange", "L) 1991-2000", "n/a") == "L) 1991-2000") {
return DomainName($feature, "serviceLineClassification", "Non-Lead", "n/a");
}