Hello Everyone,
I have two arrays pavementID and pavementCondition inside treatmentPlan object. I need to check if pavementID containes the Pavement ID of a layer (field: PvtID) or not. If yes, I have to use value of pavementCondition that corresponds with the index of PvtID in pavementID. If not, I have to use existing value of the layer (field: PCR_NBR). I wrote an arcade expression like this, but it didn't worked:
Can anyone help me with this?
Thank You.
var arcadeExp = "IIF(" + treatmentPlan.pavementIDs.includes(+"$feature.PvtID" + ) + "," + treatmentPlan.pavementCondition[treatmentPlan.pavementIDs.indexOf(+"$feature.PvtID" + )] + ",$feature.PCR_NBR )";
var majorRoadRenderer = {
type: "class-breaks",
valueExpression: "(" + arcadeExp + ")",
classBreakInfos: [{
minValue: 86,
maxValue: 100,
symbol: {
color: "#005ce6",
type: "simple-line",
style: "solid",
width: "3px",
},
}, {
minValue: 76,
maxValue: 85,
symbol: {
color: "#38a800",
type: "simple-line",
style: "solid",
width: "3px",
},
},
{
minValue: 66,
maxValue: 75,
symbol: {
color: "#fc921f",
type: "simple-line",
style: "solid",
width: "3px",
},
}, {
minValue: 56,
maxValue: 65,
symbol: {
color: "#e60000",
type: "simple-line",
style: "solid",
width: "3px",
},
}, {
minValue: 0,
maxValue: 55,
symbol: {
color: "#1a1a1a",
type: "simple-line",
style: "solid",
width: "3px",
},
}
]
};
Solved! Go to Solution.
It was all because of your effort @BlakeTerhune . Thanks Much!
It is interesting that the result of JSON.stringify(array) behaves as a text in normal JS and as an array in arcade while indexing.