Unfortunately, there is no declarative way to add IN operator in view criteria.Below code show programmatic way to add in clause in View criteria.
I have created EmployeesViewCriteria in EmployeesView view object and below method appends IN .
public void filterWithInOperator() {
ViewObjectImpl vo = this;
ViewCriteria vc =
vo.getViewCriteriaManager().getViewCriteria("EmployeesViewCriteria");
ViewCriteriaRow vcr = vc.createViewCriteriaRow();
vcr.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
ViewCriteriaItem vci = vcr.ensureCriteriaItem("DepartmentId");
vci.setOperator(JboCompOper.OPER_IN);
vci.setValueMinCardinality(3);
vci.setValueMaxCardinality(3);
vci.setValue(0, 10);
vci.setValue(1, 20);
vci.setValue(2, 30);
vc.addRow(vcr);
vo.applyViewCriteria(vc);
vo.executeQuery();
vo.setCurrentRow(this.first());
}
No comments:
Post a Comment