Focal Point
[SOLVED] Calculate Across Columns

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6217016516

January 19, 2012, 09:26 AM
K2R400
[SOLVED] Calculate Across Columns
Hello,


TABLE FILE CAR
SUM SALES
BY COUNTRY
ACROSS SEATS
END

 			SEATS 
 		2 	4	 5
ITALY  			4800  
JAPAN 			78030  
W GERMANY 		8900 	79290


It try to calculate a formulary based on 2 across columns (Column 3 div 2) :

 			SEATS 
 		2 	4	 5 	3/2
ITALY  			4800  
JAPAN 			78030  
W GERMANY 		8900 	79290 	9,91


Is-it possible ?
Thanks in advance.

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


WebFocus 7.7 (DB2 Web Query 1.1.2). IBM i
January 19, 2012, 09:52 AM
Francis Mariani
Yes, using FML. Look for "Creating Financial Reports With Financial Modeling Language (FML)" in the Creating Reports With WebFOCUS Language documentation or Creating Financial Reports With Financial Report Painter.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 19, 2012, 11:04 AM
K2R400
Thank you. Below the solution :

  
TABLE FILE CAR
SUM SALES
BY COUNTRY
ACROSS SEATS
RECAP
MyDiv/D6.2=C3/C2;
END

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


WebFocus 7.7 (DB2 Web Query 1.1.2). IBM i
January 19, 2012, 11:38 AM
Francis Mariani
You're posting a question on a WebFOCUS forum so I provided a WebFOCUS solution. With an ACROSS, a "simple divide" is not necessarily simple - what if there are more than three across columns, how would you address the individual columns?

This is what FML is for - it's not really another tool, it's an extension to the WebFOCUS code.

But since you're on DB2 Web Query, this all might be a moot point.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 19, 2012, 11:43 AM
K2R400
Sorry, I modified my previous post.
Thank you again for your precious help.


WebFocus 7.7 (DB2 Web Query 1.1.2). IBM i
January 19, 2012, 01:58 PM
Francis Mariani
That will definitely work when you can be specific about the columns (C1, C2, C3, etc). FML is used you don't know the number of columns and for much more sophisticated stuff.

"precious"? hmmmm......


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server