Focal Point
How to create 2 new column in a fex using across
December 13, 2007, 07:29 PM
DKWANHow to create 2 new column in a fex using across
A user sent this kind of request in, but we have a problem to figure out how to do that. Any idea will help us.
Thanks.
A report is needed as below
STATUS 2002 2003 2004 2005 2006 CHANGE GROWTH
NEW 9% 10% 10% 12% 12%
10 22 33 55 60 5 10%
.
.
.
TOTAL 100% .. ...
422 550 .... .. 500 600 100 20%
Our problem is how to get the Change and Growth column.
We current using a fex
Sum pct.cntx/d5.1% as '' over
cnt as ''
by status
across yr
.
.
It works fine but problem is in the NEWLY added
CHANGE, AND GROWTH column.
We can't spin off to a seperate report, since user would like to see the Change immediately
Prod: WebFOCUS 7.1.1 CGI - Self Service - Report Caster,Win2000/IIS
Output: HTML, Excel 2000 and PDF
December 14, 2007, 04:22 AM
GamPWhen you're NOT using over, you can just use the COMPUTE statement to create new columns to the right of your across fields, by specifiying the compute(s) AFTER your across statement.
But, you are using OVER, which would then mean that the use of compute after across is not possible any more. In that case you'll have to try and find a solution using fml syntax, which I'm not quite familiar with. Maybe there is someone in this forum that does know fml?
GamP
- Using AS 8.2.01 on Windows 10 - IE11. |
| in Focus since 1988 |
December 14, 2007, 11:58 AM
DKWANGamP
Thanks so much. The compute works and adds one column successfully. I'll cont to the others.
I still need to figure out how to get the difference between the last 2 col (yrs).
I never used FML before, perhaps someoneelse can show me more. Very apprecipated.
Prod: WebFOCUS 7.1.1 CGI - Self Service - Report Caster,Win2000/IIS
Output: HTML, Excel 2000 and PDF
December 14, 2007, 01:40 PM
FrankDutchFML has a lot of nice functions.
If you use the GUI you will be able to do this, otherwise you have to code it by hand
Try this code
DEFINE FILE CAR
RETAIL_SALES/D10 = SALES * RETAIL_COST;
COST/D10 = SALES * DEALER_COST;
END
TABLE FILE CAR
SUM
RETAIL_SALES
COST
COMPUTE PROFITPCT/D6.1 = (RETAIL_SALES-COST) / RETAIL_SALES * 100;
FOR
COUNTRY
'W GERMANY' LABEL CNE1 OVER
'ITALY' LABEL CNE2 OVER
RECAP TOTE = CNE1 + CNE2; AS 'TOTAL EUROPE' OVER
'JAPAN' LABEL CNA1 OVER
'TAIWAN' LABEL CNA2 OVER
RECAP TOTA = CNA1 + CNA2; AS 'TOTAL ASIA' OVER
RECAP TOT = TOTE + TOTA; AS TOTAL
'USA' LABEL CNU1 OVER
BAR AS '-'
END
And you can also do different calculations for each column.
You can add text lines in between the rows etc..
The formating is a bit more complex.
|
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 |
December 17, 2007, 12:46 PM
DKWANFrank
Thanks. I tried, but get an error of
" 0 ERROR AT OR NEAR LINE 20 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC080) WORD OR SYNTAX IN 'FOR' PHRASE (FML OPTION) NOT RECOGNIZED: USA
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT
What do you think?
Prod: WebFOCUS 7.1.1 CGI - Self Service - Report Caster,Win2000/IIS
Output: HTML, Excel 2000 and PDF
December 17, 2007, 01:18 PM
Francis Marianiyou're missing an OVER before 'USA'
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
December 17, 2007, 02:46 PM
FrankDutchDK
Yes...sorry my mistake..
does it work now?
doe you understand what this program does?
Do you have the GUI (Developer Studio)
If so try to open it in that tool and see how it works.
|
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 |
December 19, 2007, 11:56 AM
DKWANFrankDutch
The FML is working fine now. Thanks.
For my problem, since I recieved a sample code from the help line, I decided to follow their soultion. I'm getting the final output done now.
However, I'm going to spend some time on the FML to see how to put all 6 last years data and the change/growth columns of only the last 2 years.
I think I'll get a good FML report soon. Thanks again
Prod: WebFOCUS 7.1.1 CGI - Self Service - Report Caster,Win2000/IIS
Output: HTML, Excel 2000 and PDF