[OpenLayers-Users] Adding filters to a OpenLayers.Filter.Logical

Bart van den Eijnden bartvde at osgis.nl
Wed Dec 2 03:30:09 EST 2009


Hi,

why not use something like:

var my_filter = new OpenLayers.Filter.Logical({type: OpenLayers.Filter.Logical.AND});

// loop over your filters here and only add if not undefined
if (filter !== undefined) {
    my_filter.filters.push(filter);
}

Best regards,
Bart

On Dec 2, 2009, at 9:23 AM, stash wrote:

> 
> Hello,
> The name of my subject is maybe a bit confusing but nevertheless I describe
> my problem in detail. 
> 
> I have some filters which are combined with a 'logical filter' with type
> 'and'
> 
> here is my code:
> 
> var my_filter = new OpenLayers.Filter.Logical
> ({
>    type: OpenLayers.Filter.Logical.AND,
>    filters: [filter_1, filter_2, filter_3, filter_4]
> });
> 
> My problem is now, that some of this 4 filters are undefined sometimes. And
> when one filter is undefined the code doesn't work. But it can be, that all
> 4 filters are defined and therefore I have to combine the filters like that.
> 
> Now my question:
> Is there any other possibility to add the filters like I did it above. The
> best would be to add every filter not until I have checked them if they are
> defined or not.
> 
> I didn't found a my_filter.add or something like that in the class
> documentation. 
> 
> What can I do to solve this problem.
> 
> Thanks for the help.
> 
> Regards
> stash
> 
> 
> -- 
> View this message in context: http://n2.nabble.com/Adding-filters-to-a-OpenLayers-Filter-Logical-tp4098568p4098568.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 




More information about the Users mailing list