Filtering Results

Specify test criteria for group queries.

You can specify how your results are filtered by using the Query.having(com.sybase.persistence.TestCriteria) method for queries using GroupBy. For example, limit your AllType MBO's results to c.id attribute values that are greater than or equal to 0 using:

SUPQuery *query2 = [SUPQuery getInstance];
[query2 select:@"c.id, SUP(c.id)"];
[query2 from:@"AllType":@"c"];
SUPAttributeTest *ts = [SUPAttributeTest getInstance];
ts.attribute = @"c.id";
ts.testValue = @"0";
ts.operator = SUPAttributeTest_GREATER_EQUAL;
[query2 where:ts];
[query2 groupBy:@"c.id"];

SUPAttributeTest *ts2 = [SUPAttributeTest getInstance];
ts2.attribute = @"c.id";
ts2.testValue = @"0";
ts2.operator = SUPAttributeTest_GREATER_EQUAL;
[query2 having:ts2];