Select to view content in your preferred language

Editor Widget (how do I limit records in the data grid?)

1786
12
11-16-2011 08:41 AM
JerryBiedenbender
Emerging Contributor
I was wondering if there was a way to limit the records that show up in the data grid. Right now everything in the layer shows up in the grid. Is it possible to not show a record in the grid that has a status as "complete" in one of the fields. Or only populate the data grid by a date range, (only records that have a date no older than a week or something?)


Thanks,
Jerry
0 Kudos
12 Replies
MichaelKohler
Frequent Contributor
If all you want to see are the features that are not completed, set the Where clause in the XAML definition of your FeatureLayer....

<esri:FeatureLayer ID="Dispatch" Where="status <> complete"/>

Something like that will "filter" your data. You could also do this in code behind somewhere.
0 Kudos
JerryBiedenbender
Emerging Contributor
This seems like what I'm looking for but the code is not quite working. I get an error message when I use the (<>) code. If I take that out and try something else the feature layer does not display anything. Is there another way of writing the code?

Jerry
0 Kudos
JerryBiedenbender
Emerging Contributor
I figured it out. I ended up using...


FeatureLayer siteLayer = MyMap.Layers["Dispatch"] as FeatureLayer;
            siteLayer.Where = "Status <> '4'";
            siteLayer.Update(); 
0 Kudos