Consultor Eletrônico



Kbase P64332: How to partially modify the query string of a multi conditio
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/01/2004
Status: Unverified

GOAL:

How to partially modify the query string of a multi condition SDO query?

FIX:

Use the assignQuerySelection. For example:

Assume the base query is:

FOR EACH order where order-date gt 01/01/2004:

And the foreign field is cust-num so when run the query becomes:

FOR EACH order where order-date gt 01/01/2004 AND
cust-num eq 1:

Assume further that we want the sales rep filter to be included the query becomes:

FOR EACH order where order-date gt 01/01/2004 AND
cust-num eq 1 AND
sales-rep eq "gem":

The question is how to the above query string to make it reflect the change in the sales rep value as the following:

FOR EACH order where order-date gt 01/01/2004 AND
cust-num eq 1 AND
sales-rep eq "jah":

The solution is to use the assignQuerySelection. A column/operator is
considered to be unique and the value will be replaced if the same column/operator is assigned again. (This is how it handles Foreign field values
also).

Therefore,

Using
assignQuerySelection('sales-rep','gem','=')

the query becomes:

FOR EACH order where order-date gt 01/01/2004 AND
cust-num eq 1) AND
(sales-rep eq "gem"):

and using

assignQuerySelection('sales-rep','jah','=')

the query becomes

FOR EACH order where order-date gt 01/01/2004 AND
cust-num eq 1) AND
sales-rep eq "jah"):