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] PCT. WITHIN Rounding Issue

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] PCT. WITHIN Rounding Issue
 Login/Join
 
Guru
posted
Hi guys,

I have a feeling I am missing something really simple. I can't seem to get the percentage to round out properly to the closest integer using PCT. WITHIN. SET DMPRECISION = 0 doesn't seem to make a difference. I apologize I don't have a CAR file example - it's just that I need precise data to get the condition I am talking about and I have a feeling this is something simple so I didn't spend the time to manufacture the data. If it seems necessary, I'll mock some up.

Anyway, here's the code:
  
TABLE FILE HOLD
SUM SNAG_COUNT/I9 AS ''
    PCT.SNAG_COUNT/I3% WITHIN CHKLST_TYPE AS ''
BY  DISPLAY_ORDER NOPRINT
BY  CHKLST_TYPE NOPRINT
BY  HIGHEST NCR_STATUS_DISP AS ''
END


In this example, SNAG_COUNT is D9.4. But the values in it are integers (as it is a count).
Here's a sample result:
1.00	RECEIVING	Open	316	62%
		Closed	191	37%
2.00	PREASSEMBLY	Open	0	0%
		Closed	44	100%




RECEIVING Closed should be 38% because the actual value is 37.6726. PCT.SNAG_COUNT truncates the decimals instead of rounding it. How do I get the rounding to apply to the PCT.?

Regards,
Anatess

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


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Virtuoso
posted Hide Post
Just guessing here.
I think it is because of the redefinition of SNAG_COUNT/I9.
What if you tried this:
SUM SNAG_COUNT NOPRINT
    COMPUTE SNAGCOUNT/I9 = SNAG_COUNT; AS ''

That way the snag_count field will retain its original format, while the display of the field is still integer.
Again, just guessing - not tested, but worth a try.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
Anatess,
quote:
  
TABLE FILE HOLD
SUM SNAG_COUNT/I9 AS ''
    PCT.SNAG_COUNT/I3% WITHIN CHKLST_TYPE AS ''
BY  DISPLAY_ORDER NOPRINT
BY  CHKLST_TYPE NOPRINT
BY  HIGHEST NCR_STATUS_DISP AS ''
END


What is the format of SNAG_COUNT?
I would assume that it is a D or a P field since you say that the value is 37.6726.
So, I would write:
  
PCT.SNAG_COUNT/D3% WITHIN CHKLST_TYPE AS ''

The D field should produce the rounding you want.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Virtuoso
posted Hide Post
Format I (integer) always rounds down. Same for packed (P) if I recall correctly.

For proper rounding, use format D (decimal).


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
Thank you so much! D3% did it.


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report 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] PCT. WITHIN Rounding Issue

Copyright © 1996-2020 Information Builders