Select to view content in your preferred language

Wildcards in layerDefinition

1903
3
Jump to solution
09-04-2013 01:27 PM
AndrewBoyle1
Emerging Contributor
I've been working on a widget to allow a user to filter the display of a FeatureLayer by setting a layerDefinition expression in the parent ArcGISDynamicMapServiceLayer's layerDefinitions property.  I'm wondering if it is possible to use wildcard expressions in the layerDefinition?  I've tried using both '*' and '%' as wildcard characters.  I have tried using '=' and 'LIKE' as the logical operators in the expression but none of those options seem to work?

Thanks!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Andrew,

   Sure wildcards work here is a example I just tested:

    <esri:Map id="map">         <esri:extent>             <esri:Extent xmin="-13456111" ymin="4335957" xmax="-11817302" ymax="5194498">                 <esri:SpatialReference wkid="102100"/>             </esri:Extent>         </esri:extent>         <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>         <esri:ArcGISDynamicMapServiceLayer id="censusLayer" name="Census"                                            url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer">             <esri:layerDefinitions>                 <!--Oklahoma is FIPS = '40', Oregon is FIPS = '41', Pennsylvania is FIPS = '42', Rhode Island is FIPS = '44',                  South Carolina is FIPS = '45', South Dakota is FIPS = '46', Tennessee is FIPS = '47',  Texas is FIPS = '48',                 Utah is FIPS = '49',  -->                 <esri:LayerDefinition layerId="0" definition="STATE_FIPS like '4%'"/>                 <esri:LayerDefinition layerId="1" definition="STATE_FIPS like '4%'"/>                 <esri:LayerDefinition layerId="2" definition="STATE_FIPS like '4%'"/>                 <esri:LayerDefinition layerId="3" definition="STATE_FIPS like '4%'"/>             </esri:layerDefinitions>         </esri:ArcGISDynamicMapServiceLayer>     </esri:Map>

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Andrew,

   Sure wildcards work here is a example I just tested:

    <esri:Map id="map">         <esri:extent>             <esri:Extent xmin="-13456111" ymin="4335957" xmax="-11817302" ymax="5194498">                 <esri:SpatialReference wkid="102100"/>             </esri:Extent>         </esri:extent>         <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>         <esri:ArcGISDynamicMapServiceLayer id="censusLayer" name="Census"                                            url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer">             <esri:layerDefinitions>                 <!--Oklahoma is FIPS = '40', Oregon is FIPS = '41', Pennsylvania is FIPS = '42', Rhode Island is FIPS = '44',                  South Carolina is FIPS = '45', South Dakota is FIPS = '46', Tennessee is FIPS = '47',  Texas is FIPS = '48',                 Utah is FIPS = '49',  -->                 <esri:LayerDefinition layerId="0" definition="STATE_FIPS like '4%'"/>                 <esri:LayerDefinition layerId="1" definition="STATE_FIPS like '4%'"/>                 <esri:LayerDefinition layerId="2" definition="STATE_FIPS like '4%'"/>                 <esri:LayerDefinition layerId="3" definition="STATE_FIPS like '4%'"/>             </esri:layerDefinitions>         </esri:ArcGISDynamicMapServiceLayer>     </esri:Map>
0 Kudos
AndrewBoyle1
Emerging Contributor
That's good to know.  There must be some sort of bug in the widget I'm using that is causing it to not format the layer definitions correctly.  Thanks!
0 Kudos
GustafJonsson
Deactivated User

I believe it's a bug in the API sometimes decoding the expression to hexadecimal values depending on the characters following the % wildcard.

See my workaround here

https://community.esri.com/message/424756#424756

0 Kudos