Select to view content in your preferred language

Update multiple attributes in single Attribute Rule

709
4
Jump to solution
03-21-2023 08:53 AM
BrianBulla
Honored Contributor

Hi,

I'm following the tutorial here: https://community.esri.com/t5/attribute-rules-videos/update-multiple-fields-with-a-single-attribute/... , but can't seem to get this to work.  Can anyone provide some insight??

 

//first get the intersecting grid
var gridNo = FeatureSetByName($datastore, "LAND_Grid", ["GRIDNO"], false);
var intersectingGrid = first(intersects(gridNo, $feature));

//return nothing if no intersection
if (intersectingGrid==null)
{return null};

return
{"result" :
{"attributes" :
{"FACILITYID" : "HYD-" + intersectingGrid.GRIDNO + "-" + NextSequenceValue("SeqHydrants"),
"GRIDNO" : gridNo}
}
}

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

You are attempting to populate the GRIDNO attribute with a FeatureSet (gridNo) instead of a value. Did you want an attribute from the original feature ($feature.yourField) in there?

View solution in original post

4 Replies
KenBuja
MVP Esteemed Contributor

You are attempting to populate the GRIDNO attribute with a FeatureSet (gridNo) instead of a value. Did you want an attribute from the original feature ($feature.yourField) in there?

BrianBulla
Honored Contributor

Oh geez.  Yeah....that is a problem.  Always good to have a second set of eyes, but still something is not working even with this update.  Those are for sure the correct field names.  

return
{"result" :
{"attributes" :
{"FACILITYID" : "HYD-" + intersectingGrid.GRIDNO + "-" + NextSequenceValue("SeqHydrants"), "GRIDNO" : intersectingGrid.GRIDNO}}}

0 Kudos
KenBuja
MVP Esteemed Contributor

Have you checked whether you're getting back all the values you're expecting by using the Console? Make sure your sequenceName is correct.

0 Kudos
BrianBulla
Honored Contributor

Hi, yes, I have been building this step by step, so the names are correct.

I just did a re-type of the code and now it seems to be working.  Maybe the order in which the fields are updated makes a difference??  Or the formatting of how I have things typed in??  Now it looks like this and seems to be working.

This is my first time working in Arcade.  It seems very finicky.

 

BrianBulla_0-1679419203244.png

 

0 Kudos