SQL Container composite filters

Hey guys

A while back I found an example of adding composite filters (Read: Bunch of “or” and “and” filters) to a sql container, but I seem to have lost the link. Can anyone help me with finding an example of adding composite filters to a sql container? Even giving a link is just fine.


9.4.4 Book of Vaadin. Filters

They’re working the same for all kind of Containers.


    new Or(new And(new Equal("NAME", "Paul"),
                   new Or(new Less("AGE", 18),
                          new Greater("AGE", 65))),
           new Like("NAME", "A%")));
    new Equal("LASTNAME", "Johnson"));

Thanks, is there a way to dynamicly assign multiple Or filters? During a for loop perhaps?

Seems like I’ve soved it myself. Here is the code:

Filter or = new SimpleStringFilter("name", routes.get(0), false, true);
for(int i=1; i<routes.size(); i++){
	 or = new Or(or,new SimpleStringFilter("name", routes.get(i), false, true));

dataContainer → SQLContainer
routes → List

Another way:

Filter[] filterArray = new Filter[routes.size()]
for (var i=0; i < routes.size(); i++) {
        filterArray[ i ]
 = new SimpleStringFilter("name", routes.get(i), false, true);
dataContainer .addContainerFilter(new Or(filterArray));