0

I wanted to use two values to set my unique symbology for use in a map layer in ArcGIS online. Is this possible using the custom expression option? Here is the code I am using.

Unfortunately I am only getting the later value as the result. Results should be a letter for PhaseCode followed by the placement value.

DomainName($feature,"PhaseCode") + $feature.Placement
if($feature.Placement == 1){
    return 'OH';
}
    else {
    return 'UG';
}

enter image description here

2 Answers 2

0

It looks like this will:

  1. Generate a value like A1, because it's using the unmodified value of $feature.Placement.
  2. Discard the A1 just generated, because it's not assigned to a variable or returned.
  3. return the exact value specified in the return statement, which will be just the two characters OH or UG.

You probably want to store the return value from DomainName in a local variable, like this:

var domainNameFound = DomainName($feature,"PhaseCode");
if($feature.Placement == 1){
    return domainNameFound + 'OH';
}
else {
    return domainNameFound + 'UG';
}
0
DomainName($feature,"PhaseCode") + iif($feature.Placement == 1, 'OH', 'UG');

It will do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.