AnsweredAssumed Answered

syntax for JSON uniqueValueRenderer on two fields

Question asked by evtguy on Aug 21, 2012
Latest reply on Aug 22, 2012 by JGravois-esristaff
I am working on the code to add a FeatureLayer based on a JSON feed. I'm currently using a unique value renderer based on one field in the data and I'm using the style shown in the API documentation for esri.renderer.uniqueValueRenderer(json).

Let's say the field I'm currently using categorizes damage (Wind, Flood, Fire, etc) but there is an additional field which indicates severity (Low, Medium, High). I want to now incorporate that second field into my renderer. My current renderer code would look something like this:

          "drawingInfo": {      "renderer": {       "type": "uniqueValue",      "field1": "Category",      "defaultSymbol": {        "type": "esriPMS",        "url": "a/url/default.gif",        "contentType": "image/gif",        "width": 18,        "height": 18       },      "uniqueValueInfos":      [{       "value": "Flood",       "symbol": {         "type": "esriPMS",         "url": "a/url/flood.gif",         "contentType": "image/gif",         "width": 18,         "height": 18       }      },

To now incorporate the second field, would I just do the following?
          "drawingInfo": {      "renderer": {       "type": "uniqueValue",      "field1": "Category",                                         "field2": "severity",      "defaultSymbol": {        "type": "esriPMS",        "url": "a/url/default.gif",        "contentType": "image/gif",        "width": 18,        "height": 18       },      "uniqueValueInfos":      [{       "value": "Flood:Low",       "symbol": {         "type": "esriPMS",         "url": "a/url/floodLow.gif",         "contentType": "image/gif",         "width": 18,         "height": 18       }      },{       "value": "Flood:Medium",       "symbol": {         "type": "esriPMS",         "url": "a/url/floodMedium.gif",         "contentType": "image/gif",         "width": 18,         "height": 18       }      }

Thanks again!