Select to view content in your preferred language

Filtering a CSVLayer

1993
4
Jump to solution
12-14-2012 11:41 AM
MapEnglish
Frequent Contributor
Hi:

Is this possible? I've tried setting a definitionExpression with no luck - perhaps it just applies to a FeatureLayer from which it inherits. Also have tried setting a filter function on the graphicProvider property but the doc suggests this can't be done.

Any insight would be appreciated.

Thanks,
Matt English
Esri Canada
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DasaPaddock
Esri Regular Contributor
Try:

myCSVLayer.featureCollection = new FeatureCollection(filteredFeatureSet, new LayerDetails());

Having at least a default LayerDetails is required.

View solution in original post

0 Kudos
4 Replies
DasaPaddock
Esri Regular Contributor
You could use a renderer that doesn't define a symbol for the features that you don't want to be drawn.

Another option is to update the featureCollection's feature set after the layer has loaded and then reset the featureCollection property.
0 Kudos
MapEnglish
Frequent Contributor
Hi:

So I have a new FeatureSet according to some business logic, and I pass it in to a new FeatureCollection and reset my CSVLayer with that collection:


myCSVLayer.featureCollection = new FeatureCollection(filteredFeatureSet, null);

However, the map still shows my original set of features. Do I need to do anything else here?

Thanks, Matt
0 Kudos
DasaPaddock
Esri Regular Contributor
Try:

myCSVLayer.featureCollection = new FeatureCollection(filteredFeatureSet, new LayerDetails());

Having at least a default LayerDetails is required.
0 Kudos
MapEnglish
Frequent Contributor
Works like a charm! If you're interested, we're upgrading the Flex Viewer at the following site:

http://top100projects.ca/

The data will now be fed from a web CSVLayer. Clicking on the pie chart will show you the filtering behaviour we're after.

Many thanks for this,
Matt
0 Kudos