3

We are having problems using the SUPQuery function intersect in our SUP Object API project. The two queries are executing fine by them self. They are even working using the union/unionAll functions. But when trying to intersect the both, an exception occurs:

SUPPersistenceException: -131 (ERROR) %1:intersect

enter image description here

Looking at the error constant, SYNTAX_ERROR, the query is malformed (Even though they are working fine one-by-one and in a union..).

Here is what I am trying to do:

SUPQuery * query1 = [SUPQuery getInstance];
query1 = [query1 select:@"t.*"];
query1 = [query1 from:@"X_MBO":@"t"];
SUPCompositeTest * innerCompTest1 = [SUPCompositeTest getInstance];
[innerCompTest1 add:[SUPAttributeTest contains:@"t.CUSTOMER":@"C1"]];
[query1 setTestCriteria:(SUPTestCriteria *)innerCompTest1];
SUPQueryResultSet * oList1 = [myDB executeQuery:query1];
NSLog(@"oList1: %@",oList1);

SUPQuery * query2 = [SUPQuery getInstance];
query2 = [query2 select:@"QT.*"];
query2 = [query2 from:@"Y_MBO":@"QT"];
SUPCompositeTest * innerCompTest2 = [SUPCompositeTest getInstance];
[innerCompTest2 add:[SUPAttributeTest contains:@"QT.CUSTOMER":@"C1"]];
[query2 setTestCriteria:(SUPTestCriteria *)innerCompTest2];
SUPQueryResultSet * oList2 = [myDB executeQuery:query2];
NSLog(@"oList2: %@",oList2);

//Query1 & Query2 both are returning a record each

SUPQuery *query3;
if (!oList1 && oList2) {
    query3 = query2;
}
else if (oList1 && !oList2) {
    query3 = query1;
}
else {
    query3 = (SUPQuery*)[query2 intersect:query1];
}

When executing the line below the error 131 occurs.

    SUPQueryResultSet * oList3 = [myDB executeQuery:query3];
ErCa
  • 41
  • 4

0 Answers0