I'm looking for an arcade expression for arcgis pro symbology. Involves the Asset ID field to symbolise based on text within an asset ID.
Say if the asset ID contains C2
then blue (for instance), or if the asset ID contains C1
, C3
or GAS
, so on and so forth.
Imagine a treatment plant with lots of pipes of different colors all based off different common text within the asset ID.
How would the arcade expression look if trying to achieve this?
Maybe another way of putting it would be: What would the symbology expression be if i wanted; 5 different colors based off different text in the asset ID field: "C1", "C2", "C3", "GAS" and "AIR"
Im thinking the answer to my question might involve the "Contains ()" function. How does a expression look when using the contains function.
I am using the code below as a symbology expression with limited success.
var disp_txt = $feature.ASSET_ID
if (Find("-C2-", disp_txt, 0)>-1) {
return "C2";
} else if (Find("-C3-", disp_txt, 0)>-1) {
return "C3";
} else if (Find("-C1-", disp_txt, 0)>-1) {
return "C1";
} else if (Find("GAS", disp_txt, 0)>-1) {
return "BIOGAS";
} else if (Find("RS", disp_txt, 0)>-1) {
return "RAW SLUDGE";
} else if (Find("DSL", disp_txt, 0)>-1) {
return "DSL";
} else if (Find("AIR", disp_txt, 0)>-1) {
return "AIR";
} else if (Find("-G-", disp_txt, 0)>-1) {
return "GRIT";
} else if (Find("PD", disp_txt, 0)>-1) {
return "PLANTDRAIN";
} else if (Find("TD", disp_txt, 0)>-1) {
return "TANKDRAIN";
}