Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Decode function

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Decode function
 Login/Join
 
Gold member
posted
Hi everyone,

I am trying to use DECODE function to set values but having trouble finding a way to set only few values and leave others the way they are. Let's say i have a list of state values which is CA, NY, MN, and NV. What I want to do is to decode only CA and NY to California and New York and leave MN and NV as they are. How to do that? Can anyone help? Thanks in advance.

This message has been edited. Last edited by: Learner,


WebFOCUS 7.1.6 on Win 2K/IIS 6/ISAPI HTML
 
Posts: 77 | Location: San Ramon, CA | Registered: May 17, 2007Report This Post
Virtuoso
posted Hide Post
Use the 'ELSE' at the end of your decode, meaning that if it find the value, it decodes, it ELSE set it to some other value which can be the original field (value).

LONG_STATE/A20=DECODE STATE('CA' 'California' 'NY' 'New York' ELSE STATE);


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
Darin,

Thanks for the response.

This is my code. SORT/A20=DECODE &sortField('CA' 'California' 'NY' 'New York' ELSE &sortField);

I am using amper variable within the decode funciton. In my case &sortField can be NA_STATE or STATE. But the report returns only three values, California, New York and NA_STATE OR STATE.

I have actually changed the code to SORT/A20=DECODE NA_STATE('CA' 'California' 'NY' 'New York' ELSE NA_STATE), But i still get the same result... Don't understand why is that?


WebFOCUS 7.1.6 on Win 2K/IIS 6/ISAPI HTML
 
Posts: 77 | Location: San Ramon, CA | Registered: May 17, 2007Report This Post
Gold member
posted Hide Post
Tom,

Thank you for the solution. It works and I am going to using your suggestion. Thank you.

Learner


WebFOCUS 7.1.6 on Win 2K/IIS 6/ISAPI HTML
 
Posts: 77 | Location: San Ramon, CA | Registered: May 17, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Decode function

Copyright © 1996-2020 Information Builders