Consultor Eletrônico



Kbase 19088: Using AssignQuerySelection With SmartDataObject (SDO) To Set Where Clauses
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Verified

GOAL:

When you have an SDO with 2 or more tables joined, and you need to set the where clauses for more than 1 table in the SDO, the setQueryWhere function doesn't work correctly. In this situation, the assignQuerySelection function should be used.  (Note: prior to V9.0B, the assignQuerySelection function was not available.)

Customers may want to do the equivalent of:

FOR EACH order WHERE Order-num > num1,
EACH Order-Line OF Order WHERE Item-num > num2:
DISPLAY Order.Order-num Order-Line.Item-num.
END.


GOAL:

When to use assignQuerySelection instead of setQueryWhere.

FACT(s) (Environment):

Progress 9.0B

FIX:

Beginning with V9.0B, you can use the following steps to do this.

1) Create an SDO (dord-ordln) with the Order and Order-line tables.
2) Create a SmartDataBrowser, and use the SDO as the datasource.
3) Create a new SmartWindow and place the SDO, SmartBrowser, 2 Fill-ins and a button (label - Search) on it. Take all the defaults for linking the objects.
4) Change the label of Fill-in-1 to Order-Num, and the label of Fill-in-2 to Item-num.
5) In the Choose trigger of the button, place the following piece of code:


DEFINE VARIABLE pccolumns AS CHARACTER NO-UNDO.
DEFINE VARIABLE pcvalues AS CHARACTER NO-UNDO.
DEFINE VARIABLE pcOperators AS CHARACTER NO-UNDO.

ASSIGN pccolumns =  "order.order-num,order-line.item-num"
pcvalues = STRING(fill-in-1:SCREEN-VALUE) + CHR(1) +
                  STRING(FILL-IN-2:SCREEN-VALUE)
pcOperators = ">,>".

DYNAMIC-FUNCTION('assignQuerySelection':U IN h_dord-ordln, pccolumns, pcvalues, pcOperators).
DYNAMIC-FUNCTION('openQuery':U IN h_dord-ordln).

6) Run the window and type the desired Order-num and Item-num.
7) Press the Search button.