Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DECODE 1

Status
Not open for further replies.

kaeserea

Programmer
Feb 26, 2003
164
DE
Hi all!

I'd like to decode a field. I have to "translate" some values but for the rest where I don't have to do a decode I'd like WebFocus to take the original value.
Something like that:
[tt]
DEFINE FILE XYZ
NEW_FIELD/A10 = DECODE OLD_FIELD (A 'first'
B 'second'
ELSE OLD_FIELD);
END
[/tt]
Yet I guess there must be something wrong with the syntax because for all values of the OLD_FIELD which do not match A or B I have now one single value named OLD_FIELD.
However, what I wanted is that all the values that don't match A or B are displayed as they are stored in OLD_FIELD.

Does anybody know how to do this?

Eva
 
Try this:

WRK_FIELD/A10 = DECODE OLD_FIELD (A 'first'
B 'second'
ELSE 'xxx');
NEW_FIELD/A10 = IF WRK_FIELD IS 'xxx' THEN OLD_FIELD ELSE
WRK_FIELD;

a DECODE does not return the value of a field.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top