How to use conditional symbology with arcade in AGOL?

4324
3
03-18-2019 01:06 PM
DillonRhodus
New Contributor

I currently have five fields in the attribute table that I would like to represent on my AGOL map: 'Mark Called In', 'Mark Completed', 'Remark is Due', 'Remark Completed', and 'Service Complete'. We are utilizing these fields for different inspections that my organization is carrying out and would like these fields to be represented as the fields get populated using the collector app overtime.

I currently have this so far:

if (IsEmpty($feature.Mark_Called_In1)){
    return 'MARK NOT CALLED IN'
}
else if ($feature.Mark_Called_In1 > 0){
    return 'MARK CALLED IN'
}
else if (IsEmpty($feature.Mark_Completed1)){
    return 'MARK NOT COMPLETED'
}
else if ($feature.Mark_Completed1){
    return 'MARK COMPLETED'
}

However, this only returns symbology for the 'Mark Called In' and 'Mark Not Called In' fields. I would like to also add the three other fields to the script.

Any tips?

Thanks.

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

You're using if-else, which means when the conditions of an if is evaluated as true, the following ifs are skipped. Are there any instances where Mark_Called_In1 is not empty or >0? Those will be the only instances where you could get "Mark Not Completed" or "Mark Completed". If Mark_Called_In1 > 0 and you still want "Mark Not Completed" returned, you'd have to do something like this (although it would be more helpful to see your table and what the expected output should be):

var output;

if (IsEmpty($feature.Mark_Called_In1)){
    output = 'MARK NOT CALLED IN';
}
else if ($feature.Mark_Called_In1 > 0){
    output = 'MARK CALLED IN';
}
if (IsEmpty($feature.Mark_Completed1)){
    output = 'MARK NOT COMPLETED';
}
else if ($feature.Mark_Completed1){ //what are the expected values to look for here?
    output = 'MARK COMPLETED';
}

return output;
 ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
DillonRhodus
New Contributor

Thanks for the reply! And yes there are instances where Mark_Called_In1 is > 0. Would you recommend a different format for this script? This is the table that I am looking to represent. As each field's data gets collected over time, I would like to represent that in a symbol as the attributes change with priority given to the most recent change. (The Remark is Due dates is just a filler for now).

0 Kudos
KenBuja
MVP Esteemed Contributor

This is a slight variation, because there shouldn't be a case where you'll have a return of "MARK CALLED IN" if you also want to see if the Mark was completed or not.

var output;

if (IsEmpty($feature.Mark_Called_In1)){
    output = 'MARK NOT CALLED IN';
}
else if (IsEmpty($feature.Mark_Completed1)){
    output = 'MARK NOT COMPLETED';
}
else if ($feature.Mark_Completed1 > 0){ //what are the expected values to look for here?
    output = 'MARK COMPLETED';
}
return output;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos