Renderer Issue with Null values and Duplicate Symbology Issue when using Multiple Fields

868
2
Jump to solution
01-31-2021 03:12 AM
VenkataSrikanth_Dasari
Occasional Contributor

Hi @RobertScheitlin__GISP ,

Issue 1:  We created symbology with Status and DeActivated IDC status and hosted this as a map service in ArcGIS Server Manager1. Here are the values for the combination of two fields: 1,<Null>;5,<Null>;30,<Null>,1,N;5,N;30,N

When I am trying to render the layer in 4.x, layer is unable to render 1,<Null> with the blue line and applying the default symbol (<all other values>)  i.e. black line. 

So I created renderer object using UniqueValueRenderer replacing "1,<Null>" with "1, " and assigned to the Feature layer and it worked.

I wish this layer to load without renderer object in the coming later versions.

VenkataSrikanth_Dasari_4-1612088292159.png

Issue 2: 

After resolving issue1 with renderer object, I am facing issue with the symbology in the legend widget. Please refer the screenshot showing difference between two frameworks for the same layer. 

Both frameworks are using same map service hosted in 10.2 ArcGIS Server Manager.

 

3.x                                                                                                                                 4.x

VenkataSrikanth_Dasari_3-1612087733804.png

 

Here is the symbology of the conduit layer in the mxd document. For example, for In Service (blue) symbol, there are six values with the combination of two fields Status and DeactivatedIDC.

4.x is showing duplicate symbol in the legend widget where as the 3.x version showing unique symbols similar to the mxd below.

VenkataSrikanth_Dasari_4-1612088292159.png

I would like to generate same output in 3.x and 4.x. Please suggest.

 

Thanks

Srikanth Dasari

 

 

0 Kudos
1 Solution

Accepted Solutions
JeffK
by MVP Regular Contributor
MVP Regular Contributor

The legend will display each value you have listed in the uniqueValueInfos array as individual items so you need to find a way to group those similar items into one.  I don't know how you are doing it in your code to change the Nulls to 1, but using a valueExpression in the render, you can created a filter to group the items into one.  For example (untested on this dataset):

 

var renderer = {
    type: "unique-value",  // autocasts as new UniqueValueRenderer()
    valueExpression: "When($feature.Status == 1 && IsEmpty($feature.DeActivated_IDC), 'In Service', $feature.Status == 5 && IsEmpty($feature.DeActivated_IDC), 'In Service', $feature.Status == 5 && IsEmpty($feature.DeActivated_IDC), 'In Service', 'other')",
    defaultSymbol: { type: "simple-marker" },  // autocasts as new SimpleFillSymbol()
    uniqueValueInfos: [{
      // All features with value of "In Service" will be blue
      value: "In Service",
      symbol: {
        type: "simple-line",
        color: "blue"
      }
    }],

 

Arcade Logical Expressions 

valueExpression

View solution in original post

2 Replies
JeffK
by MVP Regular Contributor
MVP Regular Contributor

The legend will display each value you have listed in the uniqueValueInfos array as individual items so you need to find a way to group those similar items into one.  I don't know how you are doing it in your code to change the Nulls to 1, but using a valueExpression in the render, you can created a filter to group the items into one.  For example (untested on this dataset):

 

var renderer = {
    type: "unique-value",  // autocasts as new UniqueValueRenderer()
    valueExpression: "When($feature.Status == 1 && IsEmpty($feature.DeActivated_IDC), 'In Service', $feature.Status == 5 && IsEmpty($feature.DeActivated_IDC), 'In Service', $feature.Status == 5 && IsEmpty($feature.DeActivated_IDC), 'In Service', 'other')",
    defaultSymbol: { type: "simple-marker" },  // autocasts as new SimpleFillSymbol()
    uniqueValueInfos: [{
      // All features with value of "In Service" will be blue
      value: "In Service",
      symbol: {
        type: "simple-line",
        color: "blue"
      }
    }],

 

Arcade Logical Expressions 

valueExpression

VenkataSrikanth_Dasari
Occasional Contributor

Thank you @JeffK 

0 Kudos