Restrictions
Restrictions
If no restrictions are specified, the DataSource will read all records from specified table(s), up to the record limit. You can narrow the set of data records returned by the DataSource using one or more of object-oriented or SQL restrictions:
// SQL restriction ds.addRestriction(Restrictions.sql("status IN ('Created', 'Requested')")); // object restriction >ds.addRestriction(Restrictions.like("em", "email", "parker%")); // object restriction with an expression as a comparison value ds.addRestriction(Restrictions.lte("wr", "date_created", "${sql.date('2007-1-1')}"));
Restrictions can be grouped logically:
// combine three restrictions from the example above using logical AND
ds.addRestriction(Restrictions.and( Restrictions.sql("status IN ('Created', 'Requested')"), Restrictions.like("em", "email", "parker%"), Restrictions.lte("wr", "date_created", "${sql.date('2007-1-1')}")
));
// combine two restrictions using logical OR
ds.addRestriction(Restrictions.or(
Restrictions.like("em", "email", "parker%"),
Restrictions.lte("wr", "date_created", "${sql.date('2007-12-31')}")
));