D
Dominique
Guest
In this other question, I asked how to handle the situation where a table might be defined or not. The proposed solution I'm trying to follow, is working with dynamic "queries" instead of static ones. Unfortunately I have no idea how to do this, can anybody help me with this? Let me give you an example:
Static way of working:
Dynamic way of working:
Is it
Continue reading...
Static way of working:
Code:
FIND Table1 WHERE Table1.field1 = 123
AND Table1.field2 = Current-Table.field2
AND UPPER(Table1.field3) = "Constant-string"
AND Table1.field4 = temp-table.field4 NO-ERROR.
IF NOT AVAILABLE Table1
THEN DO:
CREATE Table1.
ASSIGN Table1.field1 = 123
Table1.field2 = Current-Table.field2
Table1.field3 = "Constant-string"
Table1.field4 = temp-table.field4.
RELEASE Table1.
END.
Dynamic way of working:
Code:
CREATE BUFFER h-Table1 FOR TABLE "Table1" NO-ERROR.
IF VALID-HANDLE(h-Table1)
THEN DO:
L-Found = h-Table1:FIND-FIRST("WHERE Table1.field1 = " + STRING(123) +
"AND Table1.field2 = " + STRING(Current-Table.field2) +
"AND UPPER(Table1.field3) = 'Constant-string'" +
"AND Table1.field4 = " + temp-table.field4) NO-ERROR.
IF NOT L-Found
THEN DO:
h-Table1:BUFFER-CREATE("").
END.
ELSE MESSAGE "FOUND".
END.
Is it
BUFFER-CREATE
or some other method, how should I fill in the parameters (like ASSIGN Table1.Field1 = 123
), ...?Continue reading...