I have a POSTGRE database where I wish to filter what featues comes back based off of a text column. I want to use the Filters on the FeauteSource to do this, but I am not certain what the proper syntax is for the filters. I have looked at the QuickFilter sample, but unfortunately this did not help.
Ultimately I want to do something along these lines
VerifiedColumn in ("Yes", "Y" )
I can do that using the FIlterCondition on a filterStyle, but that does not help me with regards to gathering Features aorund a point.
Filters on FeatureSource Syntax
Hi Richard,
I think you should want to try this API: postgreSqlFeatureLayer.FeatureSource.ExecuteQuery
That can support you query by SQL statement.
Wish that’s helpful.
Regards,
Don
Hi Richard,
The Filter property is a temporary property used by LINQ. It only available when we add some LinkSources in it. So this property is not match your requirement.
Thanks to Don’s reply, but it only answered half of your question. FeatureSource.ExecuteQuery returns us a DataTable; it is not a Collection of feature. Here is a similar post that I replied few days ago, please refer to this one to guide you to get the filtered features.
thinkgeo.com/forums/MapSuite/tabid/143/aft/12478/Default.aspx
Thanks,
Howard
Thanks Howard and Don for the speedy reply.
I could certainly implement something along the lines of the other thread, but that would double the hits on the database per layer. Is there a way to intercept the underlying query to the database so that I can modify the sql directly? I understand that this would only work with certain feature sources, but if were able to do that I could then eliminate the additional database hits.
Hi Richard,
I think it’s hard to modify the original query, but it looks the WhereClause property is helpful to append additional where clause statement when the layer query from remote server.
Regards,
Don