My Shapefile has an Integer Field named ID.
I have a string of IDs separated by commas that I need to use to filter a shapefile with
I’m using a shapefilecategory:
Dim ZN as String =“23,34,53”
Dim shpcats1 As New MapWinGIS.ShapefileCategories
Dim ct1 as MapWinGIS.ShapefileCategory = shpcats1.add(“Mypols”)
I have tried without luck:
ct1.Expression = "[ID] IN " & ZN
ct1.Expression = “[ID] IN (” & ZN & “)”
Is it possible to use the IN keyword in an expression ?
If so, how to use it ?
If not, what would be another way to do it?
I don’t know if you can use “IN”, I’m going to guess not.
I would just do it like so:
ct1.Expression = "[ID] = \"23\" OR [ID] = \"34\" OR [ID] = \"53\"";
Obviously, you’d build the above expression up in code. I guess there could be a problem if your list of IDs is very large, but it should be simple to try. The above approach works for me, but I’m only using a few statements.
Thanks Rob. Yes, I haven’t been able to make ‘IN’ work.
Don’t know if it’s a syntax problem, since I can’t find documentation
or help on expressions.
Your solution seems good but will probably hit some limit
if the list is large as you say.
George.