Hello,
I am struggling to return the attribute I want not because of Arcade but more from my logic in Arcade.
The pic below shows the same statement and the "return aa" which returns [R] and is correct but then the "return results" returns "000000" and I thought it would return FF0000 which is what I'd like. Any guidance would be huge.
Thank you so much.
GR
Solved! Go to Solution.
FeatureSerByName is grabbing a feature set, and you are testing values based on a feature. So, need to grab the feature (or features) that you are interested in first.
The post here gives a good, simple example of how to intersect and grab the result: FeatureSetBy......
Once you get it returning the result you are after ( [R], [D], [I], etc.), then you can build your "if" statements with a return for each comparisong.
R_
Also, link to entering code on forum for future reference.
Rhett,
You got me thinking logically. I created the expression
var aa = Intersects(FeatureSetByName($map, "StatesWithSenators",['Fname1','LName1', 'Balloted1']),Centroid($feature))
for (var f in aa)
if(text(f.Balloted1) == "[R]") {
return "FF0000"
}
if(text(f.Balloted1) == "[D]") {
return "0000FF"
}
if(text(f.Balloted1) == "[I]") {
return "BEBEBE"
}
and then added to the text source for my pop up
<span style="font-size:large;">Senator(s): <font color="{expression/expr8}">{expression/expr10}</font>
and it worked out perfectly. Thank you so much.
GR
Without seeing at least some code, hard to guess what you are trying to achieve, but looks like a Text() formatting useage.
Perhaps something like:
Text($feature.COLUMNAME, 'FF0000')
R_
Thank you Rhett. The expression below (which 've tried many ways now) ignores the evaluation and just returns ["000000"] .
FeatureSerByName is grabbing a feature set, and you are testing values based on a feature. So, need to grab the feature (or features) that you are interested in first.
The post here gives a good, simple example of how to intersect and grab the result: FeatureSetBy......
Once you get it returning the result you are after ( [R], [D], [I], etc.), then you can build your "if" statements with a return for each comparisong.
R_
Also, link to entering code on forum for future reference.
Rhett,
You got me thinking logically. I created the expression
var aa = Intersects(FeatureSetByName($map, "StatesWithSenators",['Fname1','LName1', 'Balloted1']),Centroid($feature))
for (var f in aa)
if(text(f.Balloted1) == "[R]") {
return "FF0000"
}
if(text(f.Balloted1) == "[D]") {
return "0000FF"
}
if(text(f.Balloted1) == "[I]") {
return "BEBEBE"
}
and then added to the text source for my pop up
<span style="font-size:large;">Senator(s): <font color="{expression/expr8}">{expression/expr10}</font>
and it worked out perfectly. Thank you so much.
GR