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]Report doesn't understand decimal places when doing math

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Report doesn't understand decimal places when doing math
 Login/Join
 
Master
posted
Ugh.

So here's the deal: I have a SQL data source with a proper master file set up for it.

I'm trying to create a DEFINE field named "PERCENT_CAPACITY" to compute a capacity value. It is in D12.2 format. The idea is to compute room capacity for a hospital.

The fields used in the computation:

NUM_ACTIVE/I11
NUM_RESERVED/I11
NUM_UNCLEAN/I11
NUM_BLOCKED/I11

The formula:

NUM_ACTIVE / (60 - NUM_RESERVED - NUM_UNCLEAN - NUM_BLOCKED) * 100

The two decimal positions in the result are ALWAYS zeroes. No amount of pleading, praying, protesting, procrastinating or programming makes any difference. I consistently get this:

NUM_ACTIVE    NUM_RESERVED    NUM_UNCLEAN    NUM_BLOCKED    PERCENT_CAPACITY
        68               1              4              0              100.00
        69               1              3              1              100.00
        70               1              2              1              100.00
        69               2              4              0              100.00

Isn't it enough to specify the D12.2 format for the final result in order to preserve the decimal place data, even though integers are used in the calculations? At one point I even created new DEFINE fields which converted the I11 integers to D12.2's. No difference whatsoever.

And why is it that the simplest of things in WebFOCUS becomes a headache and an afternoon-burner? This is the year 2016 and we've sent men to the moon by dividing numbers. What has changed since then? Rant over.

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


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Virtuoso
posted Hide Post
Hi Squatch,

Try using P12.2 instead and include your whole code into the post, it may help to find the issue.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Master
posted Hide Post
DEFINE FILE CAR
 NUM_ACTIVE/I11   = 68;
 NUM_RESERVED/I11 = 1; 
 NUM_UNCLEAN/I11  = 4; 
 NUM_BLOCKED/I11  = 0;
-* 
 PERCENT_CAPACITY/D12.2 = NUM_ACTIVE / (60 - NUM_RESERVED - NUM_UNCLEAN - NUM_BLOCKED) * 100;
END
-*
TABLE FILE CAR
PRINT COUNTRY
      NUM_ACTIVE
      NUM_RESERVED 
      NUM_UNCLEAN 
      NUM_BLOCKED
-* 
      PERCENT_CAPACITY
IF RECORDLIMIT EQ 1
ON TABLE SET ONLINE-FMT STANDARD
END  

1 PAGE     1
  
  
  COUNTRY     NUM_ACTIVE NUM_RESERVED NUM_UNCLEAN NUM_BLOCKED PERCENT_CAPACITY  
  -------     ---------- ------------ ----------- ----------- ----------------  
  ENGLAND             68            1           4           0           123.64  

Seems from your narrative you are on the right track.

Can you take a look at this sample code and result, and see if it can model your exact scenario?
 
Posts: 822 | Registered: April 23, 2003Report This Post
Master
posted Hide Post
quote:
Originally posted by MartinY:
Hi Squatch,

Try using P12.2 instead and include your whole code into the post, it may help to find the issue.

Same result with the P12.2 format.

Here's what I have:

ENGINE INT CACHE SET ON

-*COMPONENT=Define_ed_last24hr_timekey_summary_data_v
DEFINE FILE bidev/ed_last24hr_timekey_summary_data_v
PERCENT_CAPACITY/D12.2=NUM_ACTIVE / (60 - NUM_RESERVED - NUM_UNCLEAN - NUM_BLOCKED) * 100;
END

-DEFAULTH &WF_SUMMARY='Summary';
-DEFAULTH &WF_TITLE='WebFOCUS Report';

TABLE FILE bidev/ed_last24hr_timekey_summary_data_v
SUM ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.NUM_ACTIVE
ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.NUM_RESERVED
ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.NUM_UNCLEAN
ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.NUM_BLOCKED
PERCENT_CAPACITY
BY ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.ED_LAST24HR_TIMEKEY_SUMMARY_DATA_V.TIMEKEY_SQLDATE_STR
ON TABLE PCHOLD FORMAT HTML
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET SQUEEZE ON
ON TABLE SET EMPTYREPORT ON
ON TABLE SET HTMLCSS ON
ON TABLE SET HTMLENCODE ON
ON TABLE SET CACHELINES 100
ON TABLE SET GRWIDTH 1
ON TABLE SET STYLE *
-* INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, SUMMARY=&WF_SUMMARY.QUOTEDSTRING, $
ENDSTYLE
END

-RUN


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
quote:
Originally posted by David Briars:

  COUNTRY     NUM_ACTIVE NUM_RESERVED NUM_UNCLEAN NUM_BLOCKED PERCENT_CAPACITY  
  -------     ---------- ------------ ----------- ----------- ----------------  
  ENGLAND             68            1           4           0           123.64  

Seems from your narrative you are on the right track.

Can you take a look at this sample code and result, and see if it can model your exact scenario?

I get the same result as you.

I've checked all the individual pieces of data, and they seem correct. It's just that the computation seems to be discarding the decimal place data.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
It's a row-based percentage; try using COMPUTE for PERCENT_CAPACITY instead of in DEFINE


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
Hi Tom....how you?
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
Hi Linda,
Doing OK, moved to Colorado, it is wonderful!!!
How are You?


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Master
posted Hide Post
quote:
Originally posted by Tom Flynn:
It's a row-based percentage; try using COMPUTE for PERCENT_CAPACITY instead of in DEFINE

Ding ding ding! Thanks, Tom... you nailed it. Problem solved.

And thanks MartinY and David for your assistance as well.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
quote:
I get the same result as you.

Are your 'NUM_ACTIVE', 'NUM_RESERVED'... fields being SUMmed within 'TimekeyDateString'?

And do you want PERCENT_CAPACITY to operate on the totals?

If so, move your PercentCapacity calc into a COMPUTE within the TABLE FILE command.

COMPUTEs occur after summing and sorting.

Without knowing your data, this seems like something to look at.
 
Posts: 822 | Registered: April 23, 2003Report This Post
Master
posted Hide Post
quote:
Originally posted by David Briars:
quote:
I get the same result as you.

Are your 'NUM_ACTIVE', 'NUM_RESERVED'... fields being SUMmed within 'TimekeyDateString'?

And do you want PERCENT_CAPACITY to operate on the totals?

If so, move your PercentCapacity calc into a COMPUTE within the TABLE FILE command.

COMPUTEs occur after summing and sorting.

Without knowing your data, this seems like something to look at.

Yes, that's all correct. We posted at the same time so you didn't see my previous post. Thanks for the help!


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
Synchronicity!

Where is Sting, when you need him? :-)

Have a good weekend all.




Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
 
Posts: 822 | Registered: April 23, 2003Report 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]Report doesn't understand decimal places when doing math

Copyright © 1996-2020 Information Builders