How do I filter features out of ArcGISDynamicMapServiceLayer by field?

1063
0
07-18-2016 02:20 PM
JonathonGrivas
New Contributor III

Hello,

I have an app utilizing a ArcGISDynamicMapServiceLayer which I need to return images with features filtered out based on data fields in each layer. While I managed to figure out how to do this, it seems to be breaking layer visibility toggling. The code I am using to accomplish this is below:

ArcGISDynamicMapServiceLayer {

    id : dynamicLayer

    credentials : config.tdnArcGisUserCreds

    url : activeClient.dynamicMapServiceUrl

    Component.onCompleted : {

        app.dynamicLayer = dynamicLayer

    }

    onStatusChanged : {

        if (status == Enums.LayerStatusInitialized) {

            sidePanel.initLayers();

            for (var i = 0, l = dynamicLayer.dynamicLayerInfos.length; i < l; i++) {

                dynamicLayer.dynamicLayerInfos.definitionExpression = "FIELD = 'VALUE'";

            }

        }

    }

}

This results in filtered dynamic images, but completely disabled layer toggling. This also seems to send out an additional request for each layer every single time a layer is toggled. Despite that, the toggling of the layers doesn't alter the returned image.

Does anyone know what I'm doing wrong?

0 Kudos
0 Replies