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     how to add leading zeros

Read-Only Read-Only Topic
Go
Search
Notify
Tools
how to add leading zeros
 Login/Join
 
Gold member
posted
Hi, could someone remind me how to add leading 0? Number of 0 could be different each time.
It's alpha field I'm working with
Thanks


Valeriya

WebFOCUS 764 Servlet - MRE/Dashboard/Self Service/ReportCaster - Windows 2000
 
Posts: 68 | Location: Chicago | Registered: August 23, 2007Report This Post
Virtuoso
posted Hide Post
This is what IBI says to do.

DEFINE FILE CAR
VAR1/A10 WITH CAR ='0';
VAR2/D10L=ATODBL(VAR1,10,'D10');
VAR3/A10=FTOA(VAR2,'(D10Lc)',VAR3);
END
TABLE FILE CAR
PRINT CAR VAR1 VAR2 VAR3
END


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
convert the alpha field to integer and then back to alpha and the EDIT will pack it out with leading zeroes, whether you want it to or not.
DEFINE FILE CAR
MYALPHAFIELD/A8=EDIT(SALES);
temp/I8=EDIT(MYALPHAFIELD);
RESULT/A8=EDIT(temp);
END

another way , maybe more direct, is to use CTRAN which translates all instances of character in an alpha string to another character
in this case a blank (32) to a zero(48)
DEFINE FILE ...
NEWFIELD/A20=
CTRAN ( 20, fieldname , 32 , 48, 'A20');
END
(example for a field of length 20)

i find either of these ways easier than the ibi suggested hoops to jump thru. The CTRAN way would work even if some freaky alpha character snuck its way in to your input field. You might even want to RJUST your input field before you CTRAN it, just to make sure there's no freaky extra blank at the end, entered by mistake. Look at the 4th manual in the basic set, "Using Functions"




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
Gold member
posted Hide Post
Add an "L" to the format of your output field. I.E. "D12.2L" or "I11L". This will automatically pack out leading zeros to the max size.


WF 7703M, XP/Win7, MRE, RC, BID, PMF, HTML, PDF, Excel 2000/7/10
 
Posts: 73 | Location: NY | Registered: February 06, 2007Report This Post
Virtuoso
posted Hide Post
Alex

The question was that Lera used an alpha field. Your solution only works for numeric fields.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
Adding the setting:
SET CENT-ZERO = ON
may also help.
But that is also just for numeric fields....


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 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     how to add leading zeros

Copyright © 1996-2020 Information Builders