Complex queries
Author: gianni.sandigliano@unifacesolutions.com (gianni)
Hi Unifacers, [probably I am missing something here... :-) ] having the need to implement on an entity a complex query mixing ANDs and ORs like: WHERE (field1 LIKE value1 AND field2 LIKE value2 AND field3 = value3 OR field4 = value11) OR (field1 LIKE value4 AND field2 LIKE value5 AND field3 = value6 OR field4 = value12) OR (field1 LIKE value7 AND field2 LIKE value8 AND field3 = value9 OR field4 = value13) ORDER BY field4, field5, field6 As of Uniface 9.7.05 the best way I know to implement such functionality is splitting into different retrieve and ordering in the external form/service structure, like: clear field1 = value1 field2 = value2 field3 = value3 field4 = value11 retrieve creocc "myEntity", -1 field1 = value4 field2 = value5 field3 = value6 field4 = value12 retrieve/a creocc "myEntity", -1 field1 = value7 field2 = value8 field3 = value9 field4 = value13 retrieve/a sort "myEntity", "field4, field5, field6" Is there a way using only standard Uniface profiles to implement such complex query in a single shot to enable using ORDER BY capabilities from underlying RDBMS? Thanks for any hint / suggestion. Gianni P.S. I know a parser could be written to generate a complex WHERE string but AFAIK it is NOT a simple task expecially to maintain full RDBMS portability.




