Kbase P96751: Error (12298) (12298) defining data-sources for ProDataSet with two child tables having the same par
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/1/2005 |
|
Status: Unverified
FACT(s) (Environment):
OpenEdge 10.0B
SYMPTOM(s):
Getting error (12298) when defining data-sources for ProDataSet with two child tables having the same parent table.
Buffer <name> may be in only one data-source at a time. Use different buffers for the same table. (12298)
Buffer ttParent may be in only one data-source at a time. Use different buffers for the same table. (12298)
Trying to setup data-sources for ProDataSet with two child tables having the same parent table using code similar to:
DEFINE VARIABLE sWhere AS CHARACTER NO-UNDO.
DEFINE TEMP-TABLE ttParent LIKE Customer.
DEFINE TEMP-TABLE ttChild1 LIKE Order.
DEFINE TEMP-TABLE ttChild2 LIKE Invoice.
define dataset TestDS for
ttParent,
ttChild1,
ttChild2.
sWhere = "for each Customer".
define query qryParent for Customer scrolling.
define variable qryParent as handle no-undo.
qryParent = query qryParent:handle.
qryParent:query-prepare( sWhere ).
define data-source ds01 for query qryParent.
buffer ttParent:attach-data-source( data-source ds01:handle ).
sWhere = "for each Order, each ttParent where Order.CustNum = ttParent.CustNum".
define query qryChild1 for Order, ttParent scrolling.
define variable qryChild1 as handle no-undo.
qryChild1 = query qryChild1:handle.
qryChild1:query-prepare( sWhere ).
define data-source ds02 for query qryChild1.
buffer ttChild1:attach-data-source( data-source ds02:handle ).
sWhere = "for each Invoice, each ttParent where Invoice.CustNum = ttParent.CustNum".
define query qryChild2 for Invoice, ttParent scrolling.
define variable qryChild2 as handle no-undo.
qryChild2 = query qryChild2:handle.
qryChild2:query-prepare( sWhere ).
define data-source ds03 for query qryChild2.
buffer ttChild2:attach-data-source( data-source ds03:handle ).
DATASET TestDS:FILL().
FOR EACH ttParent, EACH ttChild1 WHERE ttChild1.custnum = ttParent.custnum, EACH ttChild2 WHERE ttChild2.custnum = ttParent.custnum:
DISPLAY ttParent.custnum ttChild1.ordernum ttChild2.Invoicenum.
END.
CAUSE:
A data-source and its buffer must be in a one to one relation. Only one data-source per buffer.
FIX:
Define and use a second buffer, Parent2, for the Parent table:
DEFINE VARIABLE sWhere AS CHARACTER NO-UNDO.
DEFINE TEMP-TABLE ttParent LIKE Customer.
DEFINE TEMP-TABLE ttChild1 LIKE Order.
DEFINE TEMP-TABLE ttChild2 LIKE Invoice.
/***** Here we DEFINE the second buffer, ttParent2 ******/
DEFINE BUFFER ttParent2 FOR ttParent.
define dataset TestDS for
ttParent,
ttChild1,
ttChild2.
sWhere = "for each Customer".
define query qryParent for Customer scrolling.
define variable qryParent as handle no-undo.
qryParent = query qryParent:handle.
qryParent:query-prepare( sWhere ).
define data-source ds01 for query qryParent.
buffer ttParent:attach-data-source( data-source ds01:handle ).
sWhere = "for each Invoice, each ttParent where Invoice.CustNum = ttParent.CustNum".
define query qryChild2 for Invoice, ttParent scrolling.
define variable qryChild2 as handle no-undo.
qryChild2 = query qryChild2:handle.
qryChild2:query-prepare( sWhere ).
define data-source ds03 for query qryChild2.
buffer ttChild2:attach-data-source( data-source ds03:handle ).
/***** Here we USE the second buffer, ttParent2 ******/
sWhere = "for each Order, each ttParent2 where Order.CustNum = ttParent2.CustNum".
define query qryChild1 for Order, ttParent2 scrolling.
define variable qryChild1 as handle no-undo.
qryChild1 = query qryChild1:handle.
qryChild1:query-prepare( sWhere ).
define data-source ds02 for query qryChild1.
buffer ttChild1:attach-data-source( data-source ds02:handle ).
DATASET TestDS:FILL().
FOR EACH ttParent, EACH ttChild1 WHERE ttChild1.custnum = ttParent.custnum, EACH ttChild2 WHERE ttChild2.custnum = ttParent.custnum:
DISPLAY ttParent.custnum ttChild1.ordernum ttChild2.Invoicenum.
END.