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.
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'
Yes, dropdown list values generated from Survey123 are domains. I see this when I open up the domain editor:
Out of curiosity, I ran the following:
var d = Domain($feature, "evaluator_determination");
return d;
This gave me a result of:
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.
Ok looks like to domain isn't the cause. Can you test each logical expression individually without any AND statements etc. as a check?
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...
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.