MapImageLayer Sublayers Renderer

2398
10
08-28-2018 05:19 AM
MatthieuThery1
Occasional Contributor

Can you use a Unique Value Renderer function for a MapImageLayer sublayer? 

When I try using an existing field name as a string it works, but when I try to set up a function like in the api documentation I get the error:

[esri.renderers.UniqueValueRenderer] .field: cannot write field to JSON since it's not a string value

The code I am using:

function test(feature){
}
var renderer = {
type: "unique-value", // autocasts as new UniqueValueRenderer()
field: test,

Is there a way to make it work?

0 Kudos
10 Replies
MatthieuThery1
Occasional Contributor

Ok, found the answer myself (just starting with Arcade Expressions):

Only need that:

var renderer = {
type: "unique-value"
valueExpression: "IIF( IndexOf( ["+ids+"], $feature.UID) > -1 ,'true','false')"
0 Kudos