Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     leading zeros: integers to string
Go
New
Search
Notify
Tools
Reply
  
leading zeros: integers to string
 Login/Join
 
<bigpgo>
posted
Hello. I'm trying to print my integers as strings (because I want to concatenate them with the word " days"). So when I do:

COMPUTE temp/A12 = EDIT(numDays)| ' days';

my result looks like:

"00015 days" instead of "15 days". I tried making a temporary field in define, such as:

myNum/P7S = numDays;

and then putting that into EDIT. Still same leading zeros. Please help.
 
Reply With QuoteReport This Post
Platinum Member
posted Hide Post
You need to provide the Edit mask.
So if the integer is 2 digits and 3 leading zeros to ignor..
newvalue/A12=EDIT(NUMBER,'$$$99')|' Days');

where the $ are ignored, and the 9's are selected.
 
Posts: 226 | Registered: June 08, 2003Reply With QuoteReport This Post
Guru
posted Hide Post
Take a look at the TRIM function and its possible use on an intermediate variable.
 
Posts: 252 | Location: USA | Registered: April 15, 2003Reply With QuoteReport This Post
<bigpgo>
posted
Unfortunately, I cannot use the Mask - my number of days can vary from 1 to 7 digits long, and can also be negative.

TRIM function? Where can I find documentation for that? Thanks.
 
Reply With QuoteReport This Post
Silver Member
posted Hide Post
TRIM is a function and is located in the Using Functions manual.

If you don't have the manual, here's the syntax:
TRIM(trim_where, string, string_length, pattern, pattern_length,outfield)

Ex:
CTR/A3=TRIM('L',CTR2,3,'0',1,'A3');

trim_where (alphanumeric) = L for leading, T for trailing, B for both

string (alphanumeric) = source character string enclosd in single quotes, or the field containing the string

string_length (integer) = length of string in characters

pattern (alphanumeric) = pattern to remove enclosed in single quotes

pattern_length (integer) = number of characters in pattern

outfield (alphanumeric) = field where the result is returned, or the format of the ouput value enclosed in single quotes

Hope this helps.

Raelene
 
Posts: 31 | Location: Oklahoma City, OK | Registered: September 11, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
ITEMP/I8 = 00000108; or ITEMP/I8=108; same result
FTEMP/F8=ITEMP;
BTEMP/A8=FTOA(FTEMP,'(F8)',BTEMP);
CTEMP/A15=BTEMP || ' ' | 'days';

and CTEMP is then '108 days'
This works; Icky, but works;
FTOA is 'floating point to alpha' and is on page 9-6 in the manual "Using Functions"
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
<bigpgo>
posted
FTOA worked! Thanks for all your help.

(I do not have a copy of the manual, and I have not been able to find complete documentation online; that's why I did not know about FTOA or how it worked)
Thanks again.
 
Reply With QuoteReport This Post
<monte2000>
posted
bigpo - Have you visited Tech Support or Documentation Services?
 
Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     leading zeros: integers to string

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.