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] Rounding on Count Column

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Rounding on Count Column
 Login/Join
 
Platinum Member
posted
My dataset has 100 records, and is sorted on a field called "Cycle Days'.

The report only shows the count of records for the lowest 90% of "Cycle Days" values in the dataset. So in the case of 100 records, it only displays 90 in the summary.

Sometimes this count value is off, which appears to be because WebFOCUS is only displaying the numbers to the left of the decimal place if the 90% is not a whole number.

For example, if there are 232 records, I get 208 from the CNT. field, but what I want is 209.

Is there a way to apply rounding to a "CNT." field?

DEFINE FILE TOTAL02
COL0/A50= 'New Hires;
END

TABLE FILE TOTAL02
SUM
CNT.CYCLE_DAYS AS '10PCTCUT'

BY COL0 AS 'METRIC'

ON TABLE HOLD AS 'NHCUT'
END

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


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Guru
posted Hide Post
I might be confused but I believe the CNT varible to be an integer. Maybe you should be looking at a prior selection process.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Virtuoso
posted Hide Post
I don't see how the 90% cut-off gets imposed -- apparently it's upstream from the code you posted, in a section that pulls TOTAL02 in the first place. And that's where your "rounding" issue would lie.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
If you are doing the arithmetic using floating point numbers, consider using fixed point numbers so that you may have more control over the precision.
Take a look at 'half adjust' via Google for some insights re rounding.
HTH


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Platinum Member
posted Hide Post
the issue wsa, I believe, the calculation of 90% of records, versus trying to round the CNT. field.

IBI gave me the solution to apply when I calculate 90% of records from the hold file I'm using (I did not post my full code):

-RUN
SET DMPRECISION = 0
-SET &TOTAL01= &RECORDS;
-SET &TOTAL01PCT= &RECORDS * .90;
-TYPE &TOTAL01PCT
-EXIT


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Master
posted Hide Post
If your issue is resolved, then change the subject line of your initial post to [SOLVED]
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Report This Post
Virtuoso
posted Hide Post
quote:
-RUN
SET DMPRECISION = 0
-SET &TOTAL01= &RECORDS;
-SET &TOTAL01PCT= &RECORDS * .90;
-TYPE &TOTAL01PCT
-EXIT

You need a "-RUN" after the "SET DMPRECISION ..." line, so that it will control the "-SET" lines that follow.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
I tried without -RUN after SET DMPRECISION =0, it works fine in WF 8.0. But I remember in WF 7 release we need to explicitly mention -RUN after SET DMPRECISION=0. Not sure if IBI made any internal changes for this.
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Report This Post
Virtuoso
posted Hide Post
quote:
-SET &TOTAL01PCT= &RECORDS * .90;


That will truncate rather than round.

The right-hand side expression
&RECORDS * .90
is computed in floating-point, and then converted to an integer value (with truncation) which is stored in &TOTAL01PCT

You need to force rounding on the RHS:

-SET &TOTAL01PCT= INT((&RECORDS * .90) + 0.5);

(There used to be a function for rounding, but it was withdrawn from the product.)


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
Thank you j.gross. This was the final piece I needed!


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Platinum Member
posted Hide Post
An alternate approach

define a field to get the decimal places
10PCTCUT/P12.2 WITH CYCLE_DAYS = 1;
and use a sum verb or prefix


Jim Morrow
Web Focus 7.6.10 under Windows 2003
MVS 7.3.3



 
Posts: 129 | Registered: June 01, 2005Report 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] Rounding on Count Column

Copyright © 1996-2020 Information Builders