Luc Lessard
New Member
Hi,
Progress 9.1C
In my program i receive 5 arguments.
{1} = db-name-1
{2} = db-name-2
{3} = table-name
{4} = field-name-1
{5} = field-name-2
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE qh AS WIDGET-HANDLE.
DEFINE VARIABLE bh AS WIDGET-HANDLE.
DEFINE VARIABLE fh AS WIDGET-HANDLE EXTENT 100.
CREATE BUFFER bh FOR TABLE "{1}.{3}".
CREATE QUERY qh.
qh:SET-BUFFERS(bh).
qh:QUERY-PREPARE("FOR EACH " + "{1}.{3} NO-LOCK").
qh:QUERY-OPEN.
qh:GET-FIRST.
DISPL bh:NAME. /* table name, not the label */
DO WHILE NOT qh:QUERY-OFF-END.
REPEAT i = 1 TO bh:NUM-FIELDS /* number of field in the table */.
fh = bh:BUFFER-FIELD(i). /* filed handle */
/* need this to displ some label on a report
but dont know wish one, i'm gone use buffer-compare */
FIND _file WHERE _file._file-name = bh:NAME NO-LOCK.
FIND _field WHERE _field._file-recid = RECID(_file)
AND _field._field-name = fh:NAME NO-LOCK.
PUT _file._file-label /* Table label */.
PUT fh:NAME /* Field name */
_field._label /* Field label */
STRING(fh:BUFFER-VALUE) SKIP. /* data in the field */
END.
qh:GET-NEXT.
END.
DELETE WIDGET bh.
Question:
How can i do a find of the same record in the other database in
my query loop ?
Find first {2}.{3} where ????
I cannot prepare my query with for each, first i have do know
if the record is available in the other database, for the report.
This is a old stuff that i used before but is it possible to do the same with the query prepare ?
FOR EACH {1}.{3} NO-LOCK:
FIND FIRST {2}.{3} WHERE {2}.{3}.{4} = {1}.{3}.{4}
AND {2}.{3}.{5} = {1}.{3}.{5} NO-LOCK NO-ERROR.
IF NOT AVAIL {2}.{3} THEN
PUT UNFORMATTED "not avail" SKIP.
ELSE DO:
BUFFER-COMPARE {1}.{3} EXCEPT {deamon\other\excl-{3}.i } TO {2}.{3} SAVE RESULT IN v_result.
IF v_result <> "" THEN
PUT UNFORMATTED {1}.{3}.{4} " " {1}.{3}.{5} " " v_result SKIP.
END.
END.
TIA.
Progress 9.1C
In my program i receive 5 arguments.
{1} = db-name-1
{2} = db-name-2
{3} = table-name
{4} = field-name-1
{5} = field-name-2
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE qh AS WIDGET-HANDLE.
DEFINE VARIABLE bh AS WIDGET-HANDLE.
DEFINE VARIABLE fh AS WIDGET-HANDLE EXTENT 100.
CREATE BUFFER bh FOR TABLE "{1}.{3}".
CREATE QUERY qh.
qh:SET-BUFFERS(bh).
qh:QUERY-PREPARE("FOR EACH " + "{1}.{3} NO-LOCK").
qh:QUERY-OPEN.
qh:GET-FIRST.
DISPL bh:NAME. /* table name, not the label */
DO WHILE NOT qh:QUERY-OFF-END.
REPEAT i = 1 TO bh:NUM-FIELDS /* number of field in the table */.
fh = bh:BUFFER-FIELD(i). /* filed handle */
/* need this to displ some label on a report
but dont know wish one, i'm gone use buffer-compare */
FIND _file WHERE _file._file-name = bh:NAME NO-LOCK.
FIND _field WHERE _field._file-recid = RECID(_file)
AND _field._field-name = fh:NAME NO-LOCK.
PUT _file._file-label /* Table label */.
PUT fh:NAME /* Field name */
_field._label /* Field label */
STRING(fh:BUFFER-VALUE) SKIP. /* data in the field */
END.
qh:GET-NEXT.
END.
DELETE WIDGET bh.
Question:
How can i do a find of the same record in the other database in
my query loop ?
Find first {2}.{3} where ????
I cannot prepare my query with for each, first i have do know
if the record is available in the other database, for the report.
This is a old stuff that i used before but is it possible to do the same with the query prepare ?
FOR EACH {1}.{3} NO-LOCK:
FIND FIRST {2}.{3} WHERE {2}.{3}.{4} = {1}.{3}.{4}
AND {2}.{3}.{5} = {1}.{3}.{5} NO-LOCK NO-ERROR.
IF NOT AVAIL {2}.{3} THEN
PUT UNFORMATTED "not avail" SKIP.
ELSE DO:
BUFFER-COMPARE {1}.{3} EXCEPT {deamon\other\excl-{3}.i } TO {2}.{3} SAVE RESULT IN v_result.
IF v_result <> "" THEN
PUT UNFORMATTED {1}.{3}.{4} " " {1}.{3}.{5} " " v_result SKIP.
END.
END.
TIA.