Hello!
Looking for some assistance on what I need to do to make an arcade expression work and apply an attribute rule to a feature class. What I have are two feature classes. One is an address point layer and the other is a postal code polygon layer. The address point file has a field called "POSTAL_CODE". The Postal Code polygon layer have two fields that make up the Postal Code. The two fields are "LDU" and "FSA". I want the "POSTAL_CODE" field in the address point layer to be updated with the "FSA" and the "LDU" values of the intersecting postal code polygon. It should be formatted in the POSTAL_CODE field as "FSA" + " " + "LDU", so that there is a space between the two values. e.g. here is a valid postal code = "L1N 0B7". The code I have so far is seen below. The error I'm getting is on "line 11. Semicolon or new line expected." I'm having trouble troubleshooting this one and could use some advice! Thanks!
var LDUvalue = FeatureSetByName($datastore, "ADDR_Postal_Code_Boundaries", ["LDU"], false);
var FSAvalue = FeatureSetByName($datastore, "ADDR_Postal_Code_Boundaries", ["FSA"], false);
var intersectLayer = Intersects(FSAvalue, $feature);
var cnt = Count(intersectLayer);
var result = Null;
if (cnt > 0) {
var layer = First(intersectLayer);
if (layer != null) {
result = layer.Get("FSA") + " " + layer.Get("LDU");
}
}
return result;
Solved! Go to Solution.
When you create the FSAValue layer, you're only including the FSA field and leaving off the LDU field. Give this code a try
var FSAvalue = FeatureSetByName($datastore, "ADDR_Postal_Code_Boundaries", ["FSA", "LDU"], false);
var intersectLayer = Intersects(FSAvalue, $feature);
if (Count(intersectLayer) > 0) {
var layer = First(intersectLayer);
if (layer != null) return layer.FSA + " " + layer.LDU;
}
return null;
Line 11 should look like this
result = layer.FSA + " " + layer.LDU;
That now gives me a different error unfortunately. "Error on line 11. Field not found LDU" I know for a fact that my field is called LDU in the ADDR_Postal_Code_Boundaries feature class. So I'm not sure what's happening exactly. But I appreciate your help!
When you create the FSAValue layer, you're only including the FSA field and leaving off the LDU field. Give this code a try
var FSAvalue = FeatureSetByName($datastore, "ADDR_Postal_Code_Boundaries", ["FSA", "LDU"], false);
var intersectLayer = Intersects(FSAvalue, $feature);
if (Count(intersectLayer) > 0) {
var layer = First(intersectLayer);
if (layer != null) return layer.FSA + " " + layer.LDU;
}
return null;
Duh! I can see what you mean now! Thank you!