Kbase P138223: How can I change the query for a child table in a ProDataSet to add more selection criteria?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  6/21/2010 |
|
Status: Verified
GOAL:
How can I change the query for a child table in a ProDataSet to add more selection criteria?
GOAL:
How can I filter records for a child table in a ProDataSet without using a callback?
FACT(s) (Environment):
OpenEdge 10.1x
OpenEdge 10.2x
All Supported Operating Systems
FIX:
The following sample code shows how to modify the query-prepare string for the child table in a ProDataSet to filter out child records based on other criteria in the child table:
define temp-table ttCustomer like Customer.
define temp-table ttOrder like Order.
define query qCustomer for Customer.
define query qOrder for Order.
define data-source dsCustomer for query qCustomer.
define data-source dsOrder for query qOrder.
define dataset MyDS for ttCustomer, ttOrder
data-relation MyDR for ttCustomer, ttOrder
relation-fields(CustNum, CustNum).
dataset MyDS:get-buffer-handle('ttCustomer'):attach-data-source(data-source dsCustomer:handle).
dataset MyDS:get-buffer-handle('ttOrder'):attach-data-source(data-source dsOrder:handle).
query qCustomer:query-prepare('for each Customer where CustNum < 10').
query qOrder:query-prepare('for each Order').
message data-source dsCustomer:fill-where-string view-as alert-box.
message data-source dsOrder:fill-where-string view-as alert-box.
data-source dsOrder:fill-where-string = data-source dsOrder:fill-where-string + ' and Order.OrderStatus = "Ordered"'.
message data-source dsOrder:fill-where-string view-as alert-box.
query qOrder:query-prepare('for each Order ' + data-source dsOrder:fill-where-string).
dataset MyDS:fill().
for each ttCustomer:
display ttCustomer.CustNum ttCustomer.name.
end.
for each ttOrder:
display ttOrder.CustNum ttOrder.OrderNum ttOrder.OrderStatus.
end.