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     Removing trailing zeroes after decimal point

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Removing trailing zeroes after decimal point
 Login/Join
 
Guru
posted
Hi,
I have values for a column in database table with format D20.9. I want to remove trailing zeroes after decimal point.while displaying it in report e.g, if value is 512.459000000 it should be displayed as 512.459 in the report.But if the value is 608.873009319 it should be displayed as it is.Is there any way to handle this in webfocus?Please advice.

Thanks in advance.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
 
Posts: 281 | Location: India | Registered: April 21, 2007Report This Post
Virtuoso
posted Hide Post
I'm sure there is someone out there who is smarter than me, since I can only think of this solution:
FILEDEF MAS     DISK NUMBERS.MAS
FILEDEF NUMBERS DISK NUMBERS.FTM
-RUN
-WRITE MAS FILENAME=NUMBERS, SUFFIX=FIX, $
-WRITE MAS SEGNAME=NUMBERS, $
-WRITE MAS FIELDNAME=NUMBER, FORMAT=D20.9, ACTUAL=A20, $
-WRITE NUMBERS 12.123456789
-WRITE NUMBERS 12.12345678
-WRITE NUMBERS 12.1234567
-WRITE NUMBERS 12.123456
-WRITE NUMBERS 12.12345
-WRITE NUMBERS 12.1234
-WRITE NUMBERS 12.123
-WRITE NUMBERS 12.12
-WRITE NUMBERS 12.1
-WRITE NUMBERS 12.

DEFINE FILE NUMBERS
HELP/A25 = FTOA(NUMBER, '(D20.9)', HELP);
NR1/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$$$$$$$$9');
NR2/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$$$$$$$9');
NR3/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$$$$$$9');
NR4/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$$$$$9');
NR5/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$$$$9');
NR6/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$$$9');
NR7/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$$9');
NR8/A1   = EDIT(HELP,'$$$$$$$$$$$$$$$9');
NR9/A1   = EDIT(HELP,'$$$$$$$$$$$$$$9');
NR_L/A25 = IF NR1 EQ '0' AND NR2 EQ '0' AND NR3 EQ '0' AND NR4 EQ '0' AND NR5 EQ '0' AND NR6 EQ '0' AND NR7 EQ '0' AND NR8 EQ '0' AND NR9 EQ '0' THEN EDIT(HELP,'9999999999999') ELSE
           IF NR1 EQ '0' AND NR2 EQ '0' AND NR3 EQ '0' AND NR4 EQ '0' AND NR5 EQ '0' AND NR6 EQ '0' AND NR7 EQ '0' AND NR8 EQ '0' THEN EDIT(HELP,'999999999999999') ELSE
           IF NR1 EQ '0' AND NR2 EQ '0' AND NR3 EQ '0' AND NR4 EQ '0' AND NR5 EQ '0' AND NR6 EQ '0' AND NR7 EQ '0' THEN EDIT(HELP,'9999999999999999') ELSE
           IF NR1 EQ '0' AND NR2 EQ '0' AND NR3 EQ '0' AND NR4 EQ '0' AND NR5 EQ '0' AND NR6 EQ '0' THEN EDIT(HELP,'99999999999999999') ELSE
           IF NR1 EQ '0' AND NR2 EQ '0' AND NR3 EQ '0' AND NR4 EQ '0' AND NR5 EQ '0' THEN EDIT(HELP,'999999999999999999') ELSE
           IF NR1 EQ '0' AND NR2 EQ '0' AND NR3 EQ '0' AND NR4 EQ '0' THEN EDIT(HELP,'9999999999999999999') ELSE
           IF NR1 EQ '0' AND NR2 EQ '0' AND NR3 EQ '0' THEN EDIT(HELP,'99999999999999999999') ELSE
           IF NR1 EQ '0' AND NR2 EQ '0' THEN EDIT(HELP,'999999999999999999999') ELSE
           IF NR1 EQ '0' THEN EDIT(HELP,'9999999999999999999999') ELSE HELP;
END

TABLE FILE NUMBERS
PRINT NUMBER HELP NR1 NR2 NR3 NR4 NR5 NR6 NR7 NR8 NR9 NR_L
END
A bit awkward, but it does work.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
Shankar, did you consider your previous post, http://forums.informationbuild...1057331/m/9797048706.

This can do the same thing, all you need to do is determine the number of decimal places.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
Stealing the code for GamP's temporary NUMBERS file, and using Waz's suggestion, you could do something like this. It is similar to GamP's solution, but avoids the conversions from numeric to alpha, and the searching for zeroes.

FILEDEF MAS     DISK NUMBERS.MAS
FILEDEF NUMBERS DISK NUMBERS.FTM
-RUN
-WRITE MAS FILENAME=NUMBERS, SUFFIX=FIX, $
-WRITE MAS SEGNAME=NUMBERS, $
-WRITE MAS FIELDNAME=NUMBER, FORMAT=D20.9, ACTUAL=A20, $
-WRITE NUMBERS 12.123456789
-WRITE NUMBERS 12.12345678
-WRITE NUMBERS 12.1234567
-WRITE NUMBERS 12.123456
-WRITE NUMBERS 12.12345
-WRITE NUMBERS 12.1234
-WRITE NUMBERS 12.123
-WRITE NUMBERS 12.12
-WRITE NUMBERS 12.1
-WRITE NUMBERS 12.

DEFINE FILE NUMBERS
 NR9/P20.9 = NUMBER ;
 NR8/P20.8 = NR9 ;
 NR7/P20.7 = NR8 ;
 NR6/P20.6 = NR7 ;
 NR5/P20.5 = NR6 ;
 NR4/P20.4 = NR5 ;
 NR3/P20.3 = NR4 ;
 NR2/P20.2 = NR3 ;
 NR1/P20.1 = NR2 ;
 NR0/P20.0 = NR1 ;
 FORMATX/A8 = IF (NR8 NE NR9) THEN 'D20.9' ELSE
              IF (NR7 NE NR8) THEN 'D20.8' ELSE 
              IF (NR6 NE NR7) THEN 'D20.7' ELSE 
              IF (NR5 NE NR6) THEN 'D20.6' ELSE 
              IF (NR4 NE NR5) THEN 'D20.5' ELSE 
              IF (NR3 NE NR4) THEN 'D20.4' ELSE 
              IF (NR2 NE NR3) THEN 'D20.3' ELSE 
              IF (NR1 NE NR2) THEN 'D20.2' ELSE 
              IF (NR0 NE NR1) THEN 'D20.1' ELSE 'D20.0'; 
END
-*
TABLE FILE NUMBERS
 PRINT
  NUMBER
  NUMBER/FORMATX
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Expert
posted Hide Post
Thanks Dan, for mitigating my laziness.

Big Grin


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
Thanks Dan & Waz.It really helped me to resolve this.


WF 8.1.04,Windows 7,
DataBase: Oracle 11g,Output :Excel,PDF,HTML
 
Posts: 281 | Location: India | Registered: April 21, 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     Removing trailing zeroes after decimal point

Copyright © 1996-2020 Information Builders