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] Adding a hyphen to zip codes

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved] Adding a hyphen to zip codes
 Login/Join
 
Gold member
posted
What's the best way to do this? In our table, there is a zip code column with entries formatted as 12345 for 5 digit zips and 123456789 for extended zips. For 9 digit zips, I want to make it 12345-6789, and leave the 5 digit zips without a hyphen. I tried this:
ZIP/A12 = EDIT(ZIP,'99999-9999');
Which works for 9 digit zips but 5 digit zips look like this:
12345- (with the hyphen at the end), I don't want that.
What's a way around this? I tried an IF with arclen but could never get it to work.

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


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
 
Posts: 46 | Location: Austin TX | Registered: June 04, 2009Report This Post
Master
posted Hide Post
  
EXTENDED/A4 = EDIT(ZIP, '$$$$$9999');
NEWZIP/A10 = IF EXTENDED NE '' THEN EDIT(ZIP, '99999-9999') ELSE EDIT(ZIP, '99999$');


Hope this helps




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
You could use the suggestion from TexasStingray or you could also use the length function to check the length of the value to decide what to do. Both achieve the same purpose.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Guru
posted Hide Post
try this:

ZIP/A12 = IF EDIT(ZIP) GT 99999 THEN ZIP ELSE EDIT(ZIP,'99999-9999');


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Expert
posted Hide Post
or
IF ARGLEN(9,ZIP,'I2') LE 5 THEN ZIP ELSE EDIT(...)




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Try this way...

Step 1: Capture the length in the DEFINE as ZIPINT

ZIPINT/I4 = Find the length for the "ZIP";

Step 2: Validate it as shown below...

ZIP/A12 = IF ZIPINT > 5 THEN EDIT(ZIP,'99999-9999') ELSE
ZIP END;

This should help you...

Thanks


WebFOCUS 7 6 9
Windows XP
HTML, AHTML, PDF, EXCEL
 
Posts: 24 | Registered: April 24, 2009Report This Post
Gold member
posted Hide Post
quote:
EXTENDED/A4 = EDIT(ZIP, '$$$$$9999');
NEWZIP/A10 = IF EXTENDED NE '' THEN EDIT(ZIP, '99999-9999') ELSE EDIT(ZIP, '99999$');
Hope this helps

This was absolutely perfect. Thank you and thanks to everyone else for their help.


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
 
Posts: 46 | Location: Austin TX | Registered: June 04, 2009Report This Post
Expert
posted Hide Post
I was going to add another way... But there's so many ways to do stuff in WebFOCUS (many of which are shown above)... It's Great... BTW: They're all in the documentation... Just imagine the possibilities... Then Code It.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report 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] Adding a hyphen to zip codes

Copyright © 1996-2020 Information Builders