Hi all,

Please suggest where i wrong..

if i add only one buffer and query "for each customer"

its working fine. but in case of more than 1 buffer and query like that ..

"FOR EACH customer,EACH Order OF Customer"

its given run time error..

DEFINE TEMP-TABLE ttLookup NO-UNDO

      FIELD CustNum   LIKE Customer.CustNum 

      FIELD Name      LIKE Customer.Name 

      FIELD Ordernum  LIKE Order.Ordernum 

      FIELD OrderDate LIKE Order.OrderDate 

      FIELD Itemnum   LIKE OrderLine.Itemnum 

      FIELD Linenum   LIKE OrderLine.Linenum 

      FIELD Price     LIKE OrderLine.Price 

      FIELD Qty       LIKE OrderLine.Qty. 

    DEFINE DATASET dsLookup FOR ttLookup.

    DEFINE VARIABLE hDataSourceParent AS HANDLE      NO-UNDO.

    CREATE DATA-SOURCE hDataSourceParent.

    hDataSourceParent:ADD-SOURCE-BUFFER(BUFFER Customer:HANDLE,?).

    hDataSourceParent:ADD-SOURCE-BUFFER(BUFFER order:HANDLE,?).

    DATASET dsLookup:GET-BUFFER-HANDLE(1):ATTACH-DATA-SOURCE(hDataSourceParent).

    DATASET dsLookup:GET-BUFFER-HANDLE(1):DATA-SOURCE:QUERY:QUERY-PREPARE("FOR EACH customer,EACH Order OF Customer").

    DATASET dsLookup:GET-BUFFER-HANDLE(1):BATCH-SIZE = 5.

    DATASET dsLookup:FILL().

    DATASET dsLookup:WRITE-XML("FILE","ds33.xml",YES, ?, ?,YES, NO).