Hi all,
Please suggest.. how to maintain batching.. if we have more than buffer in data-source.
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
INDEX ind IS PRIMARY UNIQUE CustNum OrderNum.
DEFINE DATASET dsLookup FOR ttLookup.
DEFINE VARIABLE rNextRowId AS ROWID NO-UNDO.
RUN proc(INPUT-OUTPUT DATASET dslookup,
INPUT-OUTPUT rNextRowId).
RUN proc(INPUT-OUTPUT DATASET dslookup,
INPUT-OUTPUT rNextRowId).
DATASET dsLookup:WRITE-XML("FILE","c:\ds33.xml",YES, ?, ?,YES, NO).
PROCEDURE proc:
DEFINE INPUT-OUTPUT PARAMETER DATASET FOR dsLookup.
DEFINE INPUT-OUTPUT PARAMETER rNextRowId AS ROWID NO-UNDO.
DEFINE VARIABLE hDataSourceParent AS HANDLE NO-UNDO.
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
CREATE QUERY hQuery.
CREATE DATA-SOURCE hDataSourceParent.
DEFINE BUFFER bCustomer FOR Customer.
DEFINE BUFFER bOrder FOR Order .
hQuery:SET-BUFFERS(BUFFER bCustomer:HANDLE,
BUFFER bOrder:HANDLE).
hDataSourceParent:ADD-SOURCE-BUFFER(BUFFER bCustomer:HANDLE,?).
hDataSourceParent:ADD-SOURCE-BUFFER(BUFFER border:HANDLE,?).
IF rNextRowId <> ? THEN
hDataSourceParent:RESTART-ROWID(2) /* ? Which Buffer's */ = rNextRowId.
hQuery:QUERY-PREPARE("FOR EACH bCustomer, EACH bOrder OF bCustomer").
hDataSourceParent:QUERY = hQuery.
DATASET dsLookup:GET-BUFFER-HANDLE(1):ATTACH-DATA-SOURCE(hDataSourceParent).
DATASET dsLookup:GET-BUFFER-HANDLE(1):BATCH-SIZE = 5.
DATASET dsLookup:FILL().
rNextRowId = hDataSourceParent:NEXT-ROWID(2). /* ? Which Buffer's */
DATASET dsLookup:GET-BUFFER-HANDLE(1):DETACH-DATA-SOURCE.
END PROCEDURE.
You need to provide rowids also for the tables that are before the unique table. So you need the rowid for both the Customer and Order in the case where Order is the last table of the query. In this particular case you might turn the query around and access Order first. However, data access really need to be able to query the tables in any order. If you filter on Customer fields you might benefit from having the Customer first while a filter on Order typically is more efficent with the Order table first.
You might want to check this recorded WebEx: http://communities.progress.com/pcom/docs/DOC-102833
Very very thank you Havard.