Constructing filters with variable length criterias

Hi,
Just implemented the new Container.Filter using this code:

Filter f  = new Or(new SimpleStringFilter(Columns.SEARCH.id(), "rpm-diastolic", true, false) , new Or(new SimpleStringFilter(Columns.SEARCH.id(), "rpm-systolic", true, false))
				,new Or(new SimpleStringFilter(Columns.SEARCH.id(), "rpm-weight", true, false))) ;
container.addContainerFilter(f);

and works fine.

Now I would like to use the following in order to build as many criterias I would need by building dynamically the filter:


List<String> filters;
for(String filter : filters) {
				Filter f  = new Or(new SimpleStringFilter(Columns.SEARCH.id(), filter, true, false) );
				container.addContainerFilter(f);
			}

How can I do this for this code doesn’t work…

Hi Patrick,

what about this:


List<String> filterNames;
List<Filter> filters;
for(String filter : filterNames) {
    filters.add(new SimpleStringFilter(Columns.SEARCH.id(), filter, true, false) );
    
}
container.addContainerFilter(new Or(filters.toArray(new Filter[filters.size()]
)));

Regards,
Pascal