Kbase P22044: Errors 247 and 7324 when using setquerywhere to modify the w
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/22/2003 |
|
Status: Unverified
SYMPTOM(s):
Errors 247 and 7324 when using setquerywhere to modify the where clause in an SDO that has foreignfields mapped to another SDO
Unable to understand after -- "cust-num = 72". (247)
PREPARE syntax is: {FOR | PRESELECT} EACH OF.. WHERE ... etc". (7324)
CAUSE:
Wrong code.
FIX:
The proper way is to use setForeignfields dynamic function instead of setquerywhere.
**For example with following original code that produces the error:
filter button:
DO:
/* filter for first SDO */
v-cond = ' NO-LOCK, FIRST order where order.cust-num =
customer.cust-num and ' + 'order.order-date = ' + STRING(fecha:SCREEN-VALUE) + ' NO-LOCK'.
DYNAMIC-FUNCTION('closeQuery':U IN h_sdo1).
DYNAMIC-FUNCTION('setQueryString':U IN h_sdo1,
INPUT 'for each customer ' + v-cond ).
DYNAMIC-FUNCTION('openQuery':U IN h_sdo1).
/* filter for second SDO */
v-cond = ' where order.cust-num = ' +
DYNAMIC-FUNCTION('columnValue':U IN h_sdo1, INPUT "cust-num") +
' and order.order-date = ' + STRING(fecha:SCREEN-VALUE) + ' NO-LOCK'.
DYNAMIC-FUNCTION('closeQuery':U IN h_sdo2).
DYNAMIC-FUNCTION('setQueryString':U IN h_sdo2,
INPUT 'for each order ' + v-cond ).
END.
"without filter" button:
DYNAMIC-FUNCTION('closeQuery':U IN h_sdo1).
DYNAMIC-FUNCTION('setQueryString':U IN h_sdo1,
INPUT 'for each customer NO-LOCK, FIRST order of customer NO-LOCK' ).
DYNAMIC-FUNCTION('openQuery':U IN h_sdo1).
**The proper way would be:
filter button:
DO:
v-cond = ' NO-LOCK, FIRST order where order.cust-num =
customer.cust-num and ' + 'order.order-date = ' + STRING(fecha:SCREEN-VALUE) + ' NO-LOCK'.
DYNAMIC-FUNCTION('setForeignFields':U IN h_sdo2,
'Order.Cust-Num,Cust-Num,Order.Order-Date,Order-Date').
DYNAMIC-FUNCTION('closeQuery':U IN h_sdo1).
DYNAMIC-FUNCTION('setQueryString':U IN h_sdo1,
INPUT 'for each customer ' + v-cond ).
DYNAMIC-FUNCTION('openQuery':U IN h_sdo1).
END.
"without filter" button:
DO:
DYNAMIC-FUNCTION('setForeignFields':U IN h_sdo2, 'Order.Cust-Num,Cust-Num').
DYNAMIC-FUNCTION('closeQuery':U IN h_sdo1).
DYNAMIC-FUNCTION('setQueryString':U IN h_sdo1,
INPUT 'for each customer NO-LOCK, FIRST order of customer NO-LOCK' ).
DYNAMIC-FUNCTION('openQuery':U IN h_sdo1).
END.