AnsweredAssumed Answered

Creating a legend with Arcade with data populated later

Question asked by kenbuja Champion on Aug 2, 2018
Latest reply on Aug 31, 2018 by kenbuja

I have a feature layer in my web map whose attributes will be edited by users. The fields to be edited have domains set up, so I know what values to expect. I want to create the legend for the expected combinations of data, but since the layer starts out with all the fields having their default attribute, I cannot do that without editing a few of the features to make sure they all the combination variants. Is there any way I can create the legend without putting dummy data in the layer?

 

My Arcade code looks like this

var status = 'Not Assigned';
if ($feature.FishPriority == 1){
    if ($feature.FishStatus == 1) {
        if ($feature.BenthicPriority == 1) {
            if ($feature.BenthicStatus == 1) {
                status = 'Both';
            } else {
                status = 'Partially Complete';
            }
        } else {
            status = 'Fish';
        }
    } else if ($feature.FishStatus == 0) {
        if ($feature.BenthicPriority == 1) {
            if ($feature.BenthicStatus == 0) {
                status = 'Neither';
            } else {
                status = 'Partially Complete';
            }
        } else {
            status = 'Fish Not Complete';
        }
    } else {
         if ($feature.BenthicPriority == 1) {
            status = 'Partially Complete';
        } else {
            status = 'Fish Terminated';
        }     
    }
}
return status;

 

with this legend as the result:

Outcomes