Query and Buffers

goos

New Member
Hello,

I've got a problem with setting buffers for a query, can anybody help me?
The problem:
I have a query and the query contains the same table 2 times:
example (part off the query):
,EACH brwa OUTER-JOIN NO-LOCK
WHERE(brwa.brwa-kc EQ rrel.rrel-rw-rel1)
,EACH brwa OUTER-JOIN NO-LOCK
WHERE(Brwa.brwa-kc EQ rrel.rrel-rw-rel2).

Now I've created a couple off buffers for the table in the query:
example:

CREATE BUFFER lhBuffer[1] FOR TABLE "bcli".
CREATE BUFFER lhBuffer[2] FOR TABLE "bwpk".
CREATE BUFFER lhBuffer[3] FOR TABLE "rrel".
CREATE BUFFER lhBuffer[4] FOR TABLE "brwa".

This doesn't work because there must Query-prepare must have 1 FOR EACH/PRESELECT for each query buffer.

Does anyone know how to solve this problem?

Greetings,

Bob Gosemeijer:confused:
 
Hi Bob,

Use "BUFFER-NAME" when you create your dynamic buffers and create a buffer for each time you need to use the same table. For instance:
Code:
CREATE BUFFER lhBuffer[1] FOR TABLE "bcli".
CREATE BUFFER lhBuffer[2] FOR TABLE "bwpk".
CREATE BUFFER lhBuffer[3] FOR TABLE "rrel".
CREATE BUFFER lhBuffer[4] FOR TABLE "brwa" BUFFER-NAME "brwa1". 
CREATE BUFFER lhBuffer[5] FOR TABLE "brwa" BUFFER-NAME "brwa2".
and then in your query use the buffer-names you assigned to the buffers, for instance
Code:
,EACH brwa1 OUTER-JOIN NO-LOCK 
WHERE(brwa1.brwa-kc EQ rrel.rrel-rw-rel1)
,EACH brwa2 OUTER-JOIN NO-LOCK 
WHERE(Brwa2.brwa-kc EQ rrel.rrel-rw-rel2).
When retrieving values from the table (buffer), use the appropriate buffer handle (in the case of the example lhBuffer[4] or lhBuffer[5]).

So basically it is the same as when you would do this with "static" buffers and a "static" query.

Hope you are no longer :confused: but :) instead!
 
Hello,

Thank you for your reaction!
But now I have the problem of max 18 tables. Does you know how to solve that?

Greetings Bob
 
Back
Top