This example shows the usage of CompositeTest, SortCriteria, and Query to locate all customer objects based on particular criteria.
Query props = new Query(); //define the attribute based conditions //Users can pass in a string if they know the attribute name. R1 column name = attribute name. CompositeTest innerCompTest = new CompositeTest(); innerCompTest.setOperator(CompositeTest.OR); innerCompTest.add(new AttributeTest("state", "CA", AttributeTest.EQUAL)); innerCompTest.add(new AttributeTest("state", "NY", AttributeTest.EQUAL)); CompositeTest outerCompTest = new CompositeTest(); outerCompTest.setOperator(CompositeTest.OR); outerCompTest.add(new AttributeTest("fname", "Jane", AttributeTest.EQUAL)); outerCompTest.add(new AttributeTest("lname", "Doe", AttributeTest.EQUAL)); outerCompTest.add(innerCompTest); //define the ordering SortCriteria sort = new SortCriteria(); sort.add("fname", SortOrder.ASCENDING); sort.add("lname", SortOrder.ASCENDING); //set the Query object props.setTestCriteria(outerCompTest); props.setSortCriteria(sort); props.setSkip(10); props.setTake(5); com.sybase.collections.GenericList<Customer> customers2 = Customer.FindWithQuery(props);