[mapguide-users] SetFilter IN

Jackie Ng jumpinjackie at gmail.com
Tue Apr 28 01:14:24 EDT 2009


If they are variables, then your line of code should really be:

districtQuery.SetFilter("Autogenerated_SDF_ID IN (" + district1 + ", " +
district2 + ", " + district3 + ")");

OR a cleaner version:

districtQuery.SetFilter(string.Format("Autogenerated_SDF_ID IN ({0}, {1},
{2})", district1, district2, district3));

- Jackie


KOBAH wrote:
> 
> Jackie,
> I even hardcoded the variables.
>         districtQuery.SetFilter("Autogenerated_SDF_ID IN (3,1) ");
> Single quote will not work here as it is integer and not string and it
> will give errors.
> 
> I tried similar stuff on SHPGEOM as well with no success.
> KOBAH
> 
> 
> 
> Jackie Ng wrote:
>> 
>> Another question I should've asked:
>> 
>> Are district1, distrct2 the actual values you are after or are they
>> variable names?
>> 
>> - Jackie
>> 
>> 
>> 
>> KOBAH wrote:
>>> 
>>> Hello,
>>> I hope users might have undergone this basic query filter in past.
>>>                districtQuery.SetFilter("Autogenerated_SDF_ID = " +
>>> district);
>>> 
>>> I just want to alter this filter to include multiple option by using IN
>>> query filter.
>>>            districtQuery.SetFilter("Autogenerated_SDF_ID IN (district1,
>>> district2, district2) ");
>>> 
>>> I am getting result for the first variable only not the others. Is my
>>> syntax right?
>>> Regards,
>>> KOBAH
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/SetFilter-IN-tp2718929p2730123.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list