I'm getting some very exaggerated numbers from the following compute statement. COMPUTE MARGIN_GOAL/P11BM = (PROJECTED_SALES * GM_PERC); AS 'Margin,Goal $'
If I run it in SQL against our iSeries, I get a very small number compared to the number webfocus is showing.
Here's an except from my master file, if it's any help. I figure it may have something to do with this packed decimal value.
Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
September 25, 2007, 03:27 PM
FrankDutch
Jason
can you post the whole script you run? both the SQL statement and the FEX.
Frank
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
September 25, 2007, 03:30 PM
Leah
As Frank asks. If you are computing, this occurs after an aggregation occurs if any 'by' statements, and if you have joins involdve you could be 'multiplying the data occurances.
Leah
September 25, 2007, 03:48 PM
Jason K.
Leah's may be right, I think that what could be happening is it's aggregating PROJECTED_SALES, then aggregating GM_PERC, then multiplying. kind of a silly order of operations. If this is true, is there any way to make it do the aggregation on the multiplied value?
my fex is massive (1000 loc), but here's a short excerpt, I hope it gets the point across. TABLE FILE MATRIX_ORDERS_TBL SUM EXT_SALES_DOLLARS/P11BM AS 'Sales,Actual' COMPUTE MARGIN_GOAL/P11BM = (PROJECTED_SALES * GM_PERC); AS 'Margin,Goal $' BY HIGHEST YEARMONTH AS 'Month' yields 40,000,000,000 or so.
Sql: SELECT yearmonth, sum(projected_sales*gm_perc) FROM SQLPROD.MATRIX_ORDERS_TBL where yearmonth = 200709 group by yearmonth;
yields: 200709 5,379,209.191409199This message has been edited. Last edited by: Jason K.,
Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
September 25, 2007, 04:00 PM
FrankDutch
I would like to see what the result in the FEX would be if you do
DEFINE FILE XXX
MARGIN_GOAL/P11BM = (PROJECTED_SALES * GM_PERC);
END
and then use the defined field MARGIN_GOAL in your request.
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
September 25, 2007, 04:09 PM
Jason K.
thanks for the thoughts folks. I went ahead and ran a performance monitor on the database to catch all the sql requests.
It shows the request as SUM(PROJECTED_SALES) SUM(GM_PERC)
SO, it's doing exactly as leah mentioned. I'm going to have to do the calculation at the row level of the database.
Thanks!
Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.