Select to view content in your preferred language

Symbology expression for dropdown list

835
5
01-26-2024 10:32 PM
AliciaMcMurchie1
Occasional Contributor

I'm trying to create a custom symbology on a map using a feature layer from a Survey123 survey. I'm not sure how to refer to fields created via a predefined dropdown list, though. Referring to their contents as '[value]' doesn't seem to work, like it does for regular string text.

I've pasted my expression below. evaluator_determination is a field with dropdown list options null, Feasible, and Unfeasible. I'm trying to return "Needs Review - Evaluator Marked Feasible" if evaluator_determination is Feasible and approver_determination is null, and return "Needs Review - Evaluator Marked Unfeasible" if evaluator_determination is Unfeasible and approver_determination is null. If I swap out evaluator_determination for a regular string field and use the same syntax, it does work, so I think the issue is the dropdown list - I could be wrong, though.

var output;

If(
  $feature.evaluator_determination == 'Unfeasible' &&
  IsEmpty($feature.approver_determination)){
    output = 'Needs Review - Evaluator Marked Unfeasible';
  }
else if(
  $feature.evaluator_determination == 'Feasible' &&
  IsEmpty($feature.approver_determination)){
    output = 'Needs Review - Evaluator Marked Feasible';
  }

return output;
 
0 Kudos
5 Replies
DavidPike
MVP Frequent Contributor

If these are domains, are you referring to the the code?  I'm not sure if you can refer to the domain description.

Go to the data data of your fea

ture layer, then 'fields' tab and select your field.  You should then be able to see the domain codes and descriptions if you open up the domain editing option.

If this is the case then possibly just try to use the domain code e.g.

$feature.approver_determination == 1234

or use DomainName() function https://developers.arcgis.com/arcade/function-reference/feature_functions/#domainname :

DomainName($feature, 'approver_determination') == 'unfeasible'

 

AliciaMcMurchie1
Occasional Contributor

Yes, dropdown list values generated from Survey123 are domains. I see this when I open up the domain editor:

AliciaMcMurchie1_1-1706393139062.png

Out of curiosity, I ran the following:

var d = Domain($feature, "evaluator_determination");
return d;

This gave me a result of: 

AliciaMcMurchie1_2-1706393299603.png

I'm not sure what to do with that information, though. I've tried a few combinations of expressions, but nothing has been successful. I'm sure this is more to do with my unfamiliarity with writing expressions like this than anything else. 

0 Kudos
DavidPike
MVP Frequent Contributor

Ok looks like to domain isn't the cause.  Can you test each logical expression individually without any AND statements etc. as a check?  

0 Kudos
AliciaMcMurchie1
Occasional Contributor

The second part of the statement (the IsEmpty part) runs, but the first part incorrectly returns null in the following scenarios: 

 

If(
  $feature.evaluator_determination == 'Unfeasible'){
    return 'Unfeasible';
  }
If(
  DomainName($feature, 'evaluator_determination') == 'Unfeasible'){
    return 'Unfeasible';
  }

 

 

I think the issue is that I need to write a "For ... in" statement. I think what I've been doing is just instructing arcade to look at a single row of the attribute table. EDIT: That can't be right, since based on this, it looks like a loop shouldn't be needed https://support.esri.com/en-us/knowledge-base/how-to-assign-colored-symbols-to-attributes-using-arca...

0 Kudos
AliciaMcMurchie1
Occasional Contributor

Okay, I found the problem, and it wasn't my expression, it was my own user error. I had been expecting more to return in the expression console, and it just doesn't. The expression shows the correct symbology in the map. 

0 Kudos