AXMIM
AXMIM

Reputation: 2472

Can `BUFFER-COMPARE` receive fields to compare dynamically?

When trying to dynamically set the USING fields of BUFFER-COMPARE, I get the following error.

WARNING: The USING phrase of the BUFFER-COMPARE statement only honors fields in the source buffer. Ignoring 'cFieldsToCompare'. (5379)

Here is a code sample to clarify, I would like to only compare Field1, Field2, Field4 between buf_target and buf_origin. However, I can't simply write the fields down because they are provided and won't always be the same.

DEFINE VARIABLE cChangedFields      AS CHARACTER  NO-UNDO.
DEFINE VARIABLE cFieldsToCompare    AS CHARACTER  NO-UNDO.

cFieldsToCompare = "Field1,Field2,Field4"

BUFFER-COMPARE buf_target 
USING cFieldsToCompare
TO buf_origin 
SAVE RESULT IN cChangedFields NO-ERROR.

Is there a syntaxe that allow BUFFER-COMPARE to receive fields to compare dynamically?

Upvotes: 1

Views: 1150

Answers (1)

Mike Fechner
Mike Fechner

Reputation: 7192

You can use the BUFFER-COMPARE method of the Buffer handle:

BUFFER buf_target:BUFFER-COMPARE (BUFFER bug_origin:HANDLE, ?, cExceptFields, cFieldsToCompare) . 

Upvotes: 4

Related Questions