As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I am hoping this is a stupid question, but I am having trouble finding documentation for it. Maybe someone can easily answer for me:
Here is the scenario: I am using DECODE to reassign some field values. Pretty straight forward.
So,
DECODE FIELD1('The Fieldname Value A' 'A'
'The Field Value B' 'B' ...
That sort of thing. But instead of assigning a default literal value, like: ELSE 'Other', I want to use the incoming field value if that value has not been included in the DECODE.
So, instead of:
DECODE FIELD1('The Fieldname Value A' 'A'
'The Field Value B' 'B'
ELSE 'Other');
I want something like:
DECODE FIELD1('The Fieldname Value A' 'A'
'The Field Value B' 'B'
ELSE FIELD1);
Where the table value of FIELD1 is displayed, if a decoded value has not been supplied for that field value.
I am sure that I had some method of doing this at some point (and that it was simple), but I'm banging my head on the desk a bit trying to figure it out now. I am sure that I could do it with a couple of DEFINE fields, but I am trying to avoid getting into a large, convoluted IF THEN ELSE statement.
Any tips would be appreciated.This message has been edited. Last edited by: Kerry,
DEFINE FILE CAR
NEWCAR/A20 = DECODE CAR ('JAGUAR' 'JAG' 'JENSEN' 'JEN' );
NEWCAR2/A20 = IF NEWCAR NE ' ' THEN NEWCAR ELSE CAR;
END
TABLE FILE CAR
PRINT CAR NEWCAR NEWCAR2
END
In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005
The bottom of the function definition in the documentation says:
quote:
You can use up to 40 lines to define the code and result pairs for any given DECODE function, or 39 lines if you also use an ELSE phrase. Use either a comma or blank to separate the code from the result, or one pair from another.
So in practice you can put those comma's wherever you like and it should work.
So apparently you could also write it as:
... = DECODE CAR ('JAGUAR','JAG' 'JENSEN','JEN' ELSE '');
... = DECODE CAR ('JAGUAR','JAG','JENSEN','JEN',ELSE '');
I am a bit surprised that a comma before the ELSE statement is accepted though!
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
You can use up to 40 lines to define the code and result pairs for any given DECODE function, or 39 lines if you also use an ELSE phrase. Use either a comma or blank to separate the code from the result, or one pair from another.