Combining fields with UniqueValueDefinition ()

264
0
10-25-2017 06:43 AM
pablorojas
New Contributor

   
hello community

I have to finish a product for a client in which a classification by category should be done as done in argis desktop, I am using UniqueValueDefinition () with several fields (3) but when it does the combination and it shows me the result, the values that come out are those of their value, someone knows how to fix this, example:

var classdef = new UniqueValueDefinition ();
classdef.attributeField = this.fieldItems.item.name;
if (this.fieldItems2.item) {classdef.attributeField2 = this.fieldItems2.item.name}
if (this.fieldItems3.item) {classdef.attributeField3 = this.fieldItems3.item.name}
if (this.fieldItems2.item || this.fieldItems3.item) {classdef.fieldDelimiter = ",";}
var colorRamp = new AlgorithmicColorRamp (); // color algorithm
colorRamp.fromColor = new Color.fromHex ("# 568974");
colorRamp.toColor = new Color.fromHex ("762317");
colorRamp.algorithm = "hsv";
classdef.baseSymbol = this.createSymbol (); // symbol goes here
classdef.colorRamp = colorRamp;
var params = new GenerateRendererParameters ();
params.classificationDefinition = classdef;
console.log ("params", params);
var generateRenderer = new GenerateRendererTask (this.parameters.url);
console.log ("classdef", classdef);
console.log ("generaterender", generateRenderer);
generateRenderer.execute (params, lang.hitch (this, this.applyRenderer), this.errorHandler);

applyRenderer: function (renderer) {
console.log ("starting rendering");
// dynamic layer stuff
console.log (renderer);
var optionsArray = [];
var drawingOptions = new LayerDrawingOptions ();
drawingOptions.renderer = renderer;
// set the drawing options for the relevant layer optionsArray index corresponding to layer index in the map service
optionsArray [this.parameters.idPos] = drawingOptions;
this.parameters.layer.setLayerDrawingOptions (optionsArray);
this.parameters.layer.show ();
this.createLegend ();
},

the fields come this way:

this.fieldItems.item.domain.codedValues: {value: 1, symbol: {...}, label: "bucaramanga"}
this.fieldItems.item.domain.codedValues: {value: 68, symbol: {...}, label: "santander"}

and renderer that is rendered goes like this:

renderer: {value: 1, 68, symbol: {...}, label: "1, 68"}

I need you to label me, label: "bucaramanga, santander". If I achieve this I would end with my product, it can be done, the help is appreciated.

0 Kudos
0 Replies