Hello,
I am just starting my first attempts with attribute rules and I am still quite inexperienced with ArcGIS Arcade. I came across the following blog post and tried to recreate it for the automatic creation of a point feature when creating an area feature. However, when checking with the Verify button, I always get the message that there are bracket errors. However, when I try to reproduce my input in Notepad++, I don't understand where the bracket error is specifically.
var pointfeature = Centroid($Feature)
return {
"edit": [
{
"className" : "point"
"adds": [
{
"attributes":
{"polygon_ID" : $feature.GlobalID
},
"geometry" : pointfeature
}
]
}
]
}
Solved! Go to Solution.
Edit: To avoid this in the future (I make these mistakes all the time) you can paste your arcade script into an editor like VSCode and set the language to JavaScript. It'll find syntax errors for you and even give you quick fix options!
You just missed a comma in your edits dictionary:
var pointfeature = Centroid($Feature)
return {
"edit": [
{
"className" : "point", //Missed a comma here
"adds": [
{
"attributes":
{
"polygon_ID" : $feature.GlobalID
},
"geometry" : pointfeature
}
]
}
]
}
Hi @PatrickLösel,
So the geometry needs to be a point feature, which you can look up in the documentation here. In terms of the code, it might be that there is an inherent syntax issue with part of the code reading as text and not script.
Try writing the code using the point feature that is mentioned and see if that does the trick.
Edit: To avoid this in the future (I make these mistakes all the time) you can paste your arcade script into an editor like VSCode and set the language to JavaScript. It'll find syntax errors for you and even give you quick fix options!
You just missed a comma in your edits dictionary:
var pointfeature = Centroid($Feature)
return {
"edit": [
{
"className" : "point", //Missed a comma here
"adds": [
{
"attributes":
{
"polygon_ID" : $feature.GlobalID
},
"geometry" : pointfeature
}
]
}
]
}