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.
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.
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, 2007
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, 2007