I'm a bit new to dynamic queries and don't fully understand them, mostly, I've been using code developed by other programmers to learn it. Here's a problem I've encountered that I'm not sure how to approach.
Heres the situation:
I have 2 dynamic temp-tables (t-hdl-tbl1, t-hdl-tbl2) and their buffers (tb-hdl-tbl1, tb-hdl-tbl2).
How do I do the above query dynamically? I've got the FOR EACH tbl1 portion down I believe:
I also thought the v-where could just be bigger and have the FIND FIRST in it, but that didn't work.
Heres the situation:
I have 2 dynamic temp-tables (t-hdl-tbl1, t-hdl-tbl2) and their buffers (tb-hdl-tbl1, tb-hdl-tbl2).
Code:
FOR EACH tbl1:
FIND FIRST tbl2 WHERE tbl2.item = tbl1.item NO-ERROR.
How do I do the above query dynamically? I've got the FOR EACH tbl1 portion down I believe:
Code:
ASSIGN v-table-name = tb-hdl-tbl1:NAME
v-where = "FOR EACH " + v-table-name.
CREATE QUERY v-hdl-query.
v-hdl-query:SET-BUFFERS(tb-hdl-tbl1).
v-hdl-query:QUERY-PREPARE(v-where).
v-hdl-query:QUERY-OPEN().
v-hdl-query:GET-FIRST().
REPEAT WHILE NOT v-hdl-query:QUERY-OFF-END.
/* This is where the FIND FIRST goes */
END.
I also thought the v-where could just be bigger and have the FIND FIRST in it, but that didn't work.