sqlatg

ATG RQL query like SQL 'property in (x, y, z)'


I'm trying to write an RQL query that does the equivalent of this sql:

select * from some_table t where t.property in (1, 2, 3, 4 ...)

I'm not sure if RQL supports this though. In the oracle docs, there's an example of how to do this on the ID property of a repository item:

ID IN { "0002421", "0002219", "0003244" ... }

but when I try to change ID in this example to the property I want to query on, I get an RQL ParseException.

Does anyone know if this is possible?


Solution

  • this is possible through querybuilder api(see example below). I'm not sure why this is not available through plain RQL though.

    QueryExpression thePropertyExpression =     
       theQueryBuilder.createPropertyQueryExpression("postalCode");
    
    String [] zipcodeArray = {"22185", "22183"};
    
    QueryExpression theValueExpression = 
        theQueryBuilder.createConstantQueryExpression(zipcodeArray);
    
    Query theQuery = 
        theQueryBuilder.createIncludesQuery(theValueExpression, thePropertyExpression);