11.7
I have a dataset that is filled With several temp-tables, filled up and using the relation between buffers. So I am able to do i.e.:
dsh:get-buffer-handle('myChild'):synchronize(), and I will get the correct record.
My problem is that I want to get all the records that myChild has, no only the first record...
bhFrom = ParentDataSet:GET-BUFFER-HANDLE('PartyIdentifier') NO-ERROR
qh = ParentDataSet:get-relation('PartyIdentifier'):QUERY.
qh:GET-FIRST(NO-LOCK).
DO WHILE NOT qh:QUERY-OFF-END:.
:
qh:get-next().
end.
This seems to give me all records, not only the related....
It should be possible?
//Geir Otto
Then I have found that the synchronize() only gets me the first record, and I have to do my own filtering, so this what I did...
:
bh = BusinessAcknowledgementDataSet:GET-BUFFER-HANDLE ('PartyIdentifier').
bhFrom = ParentDataSet:GET-BUFFER-HANDLE('PartyIdentifier') NO-ERROR.
IF NOT VALID-HANDLE(bhFrom) THEN
DO:
JBoxLogging:Instance:LOG('Tabellen ' + quoter(bh:NAME) + ' er ikke tilgjengelig i dataset det kopieres fra, hopper over denne tabell' ).
RETURN.
END.
bfh_id = bhFrom:buffer-field(ipbhParent:name + '_id') no-error.
if valid-handle(bfh_id) then do:
create query qh.
qh:set-buffers(bhFrom).
qh:QUERY-PREPARE ('for each ' + bhFrom:name + ' where ' + ipbhParent:name + '_id <> ? ').
qh:query-open().
qh:get-first(no-lock).
do while not qh:QUERY-OFF-END:
:
:
Sorry, I refered to myChild, but that is PartyIdentifier :-)
I need to add some setup here :-)
I use Add-Parent-ID-Relation to bind the buffers.
MeasuringTicketDataSet:ADD-PARENT-ID-RELATION(TEMP-TABLE SenderParty:DEFAULT-BUFFER-HANDLE,TEMP-TABLE PartyIdentifier:DEFAULT-BUFFER-HANDLE,"SenderParty_id",?,?).
So I only see ParentBuffer handle, and I know it has been done a synchronize(), so I have the first record. I Wonder if I can find the relation from within the buffer. Otherwise I will need to Write a where statement....dynamic of course ...
Then I have found that the synchronize() only gets me the first record, and I have to do my own filtering, so this what I did...
:
bh = BusinessAcknowledgementDataSet:GET-BUFFER-HANDLE ('PartyIdentifier').
bhFrom = ParentDataSet:GET-BUFFER-HANDLE('PartyIdentifier') NO-ERROR.
IF NOT VALID-HANDLE(bhFrom) THEN
DO:
JBoxLogging:Instance:LOG('Tabellen ' + quoter(bh:NAME) + ' er ikke tilgjengelig i dataset det kopieres fra, hopper over denne tabell' ).
RETURN.
END.
bfh_id = bhFrom:buffer-field(ipbhParent:name + '_id') no-error.
if valid-handle(bfh_id) then do:
create query qh.
qh:set-buffers(bhFrom).
qh:QUERY-PREPARE ('for each ' + bhFrom:name + ' where ' + ipbhParent:name + '_id <> ? ').
qh:query-open().
qh:get-first(no-lock).
do while not qh:QUERY-OFF-END:
:
: