Skip Headers

# Boolean Logic

Previous

Next

Expressions use standard boolean operators, such as `AND`, `OR`, and `NOT`, and you can combine multiple expressions to form more complex expressions. Example: Using Boolean Logic in an Expression illustrates a code fragment that queries for projects managed by a selected person, and that have a budget greater than or equal to 1,000,000.

Using Boolean Logic in an Expression

    ExpressionBuilder project = new ExpressionBuilder();
    Expression hasRightLeader, bigBudget, complex;
    Employee selectedEmp = someWindow.getSelectedEmployee();
    hasRightLeader = project.get("teamLeader").equal(selectedEmp);
    bigBudget = project.get("budget").greaterThanEqual(1000000);
    complex = hasRightLeader.and(bigBudget);
    Vector projects = session.readAllObjects(Project.class, complex);