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] Can you divide a packed by a decimal...

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Can you divide a packed by a decimal...
 Login/Join
 
Master
posted
The code below runs fine but yeilds: 0.00 for every PERCENTAGE value.

BADDEBT is a P20.2 field
CHGS is a d20.2 field

code...
.
.
.
DEFINE FILE HOLDMERGE
PERCENTAGE/D12.2=HOLDMERGE.HOLDMERG.BADDEBT / HOLDMERGE.HOLDMERG.CHGS;
END

TABLE FILE HOLDMERGE
SUM
HOLDMERGE.HOLDMERG.BADDEBT
HOLDMERGE.HOLDMERG.CHGS
HOLDMERGE.HOLDMERG.PERCENTAGE
BY LOWEST HOLDMERGE.HOLDMERG.FY
BY LOWEST HOLDMERGE.HOLDMERG.PERIOD
BY LOWEST HOLDMERGE.HOLDMERG.BANBR
WHERE HOLDMERGE.HOLDMERG.FY EQ 2014;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET BYDISPLAY ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
.
.
.
is there a conversion I must do first? I tried it as a compute...same result...pretty sure it should be a define though....

THANKS AGAIN!

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report This Post
Virtuoso
posted Hide Post
I created a sample report using the CAR table testing all combinations I could think of to divide decimal and packed decimal values and noticed no difference in the results whatsoever.

DEFINE FILE CAR
D_DEALER_COST/D20.2 = DEALER_COST + (SEATS * 7 / 100);
P_DEALER_COST/P20.2 = DEALER_COST + (SEATS * 7 / 100);

D_RETAIL_COST/D20.2 = RETAIL_COST + (SEATS * 9 / 100);
P_RETAIL_COST/P20.2 = RETAIL_COST + (SEATS * 9 / 100);

D_D_D/D20.2 = D_DEALER_COST / D_RETAIL_COST;
D_D_P/P20.2 = D_DEALER_COST / D_RETAIL_COST;
D_P_D/D20.2 = D_DEALER_COST / P_RETAIL_COST;
D_P_P/P20.2 = D_DEALER_COST / P_RETAIL_COST;
P_D_D/D20.2 = P_DEALER_COST / D_RETAIL_COST;
P_D_P/P20.2 = P_DEALER_COST / D_RETAIL_COST;
P_P_D/D20.2 = P_DEALER_COST / P_RETAIL_COST;
P_P_P/P20.2 = P_DEALER_COST / P_RETAIL_COST;
END
TABLE FILE CAR
PRINT
        D_DEALER_COST
        P_DEALER_COST
        D_RETAIL_COST
        P_RETAIL_COST
        D_D_D
        D_D_P
        D_P_D
        D_P_P
        P_D_D
        P_D_P
        P_P_D
        P_P_P
BY MODEL
ON TABLE SET PAGE NOPAGE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, BORDER=1, BORDER-COLOR='GRAY', $
TYPE=TITLE, BACKCOLOR='SILVER', $
ENDSTYLE
END





I'm using data straight out of a FOCUS data source though.

You may need to run a similar test with your particular data source paying close attention to what USAGE and ACTUAL definitions you have in your masterfile and perhaps review the iWay adapter documentation for your specific database to see how numeric values are mapped and represented.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
You definitely can combine D and P format data items in an arithmetic expression.

It's not clear why you are getting 0.00; but for a percent (as opposed to a ratio) you need to multiply by 100.

If your SUM verb is actually summing detail data (rather than pre-summarized data) you need to make the Percentage column a COMPUTE within the TABLE request, not a DEFINE (and don't forget the scaling factor of 100).
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
you're creating a ratio at the granular level, and then summing it. that's not wise.
you probably want to do a COMPUTE
which will operate on the SUMMED numerator (your column 1) and the SUMmed denominator (your column 2).
TABLE FILE IBISAMP/CAR
SUM SALES DCOST
AND COMPUTE PROFIT/D12M=SALES-DCOST;
AND COMPUTE PROFIT2/D12M=C1-C2 ;
BY CAR
END
-* you can do it several ways: field references, column# references, etc.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Master
posted Hide Post
Yes, it needed to be a compute. I thought my HOLD tables would have yeilded a single row by the time it go to this point but they did not. The compute is appropriate and works. Thanks all!!


******CLOSED


WebFOCUS 8206.08
Windows, All Outputs
 
Posts: 603 | Registered: June 28, 2013Report 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] Can you divide a packed by a decimal...

Copyright © 1996-2020 Information Builders