Focal Point
[SOLVED] FML RECAP % in Excel

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

February 15, 2011, 06:09 PM
Swamp
[SOLVED] FML RECAP % in Excel
When I run this to PDF it works fine. But when I run it to EXL2K the % line loses its formatting. Try running it with commenting out the line "ON TABLE PCHOLD FORMAT EXL2K" or changing it to PDF output.

SET &ECHO=ALL

DEFINE FILE CAR
COST/D15 = SALES * DEALER_COST;
END

TABLE FILE CAR
SUM
COST/D10 AS 'Cost'

ACROSS HIGHEST SEATS

FOR
COUNTRY
'W GERMANY' LABEL CNE1 OVER
'ITALY' LABEL CNE2 OVER
'ENGLAND' LABEL CNE3 OVER
RECAP TOTE = CNE1 + CNE2 + CNE3; AS 'TOTAL EUROPE' OVER
RECAP TOTP/D5.2CB% = (CNE1/TOTE) * 100; AS 'W GERMANY % of EUROPE' OVER

'JAPAN' LABEL CNA1 OVER
'TAIWAN' LABEL CNA2 OVER
RECAP TOTA = CNA1 + CNA2; AS 'TOTAL ASIA' OVER

RECAP TOTT = TOTE + TOTA; AS 'TOTAL'

ON TABLE SET PAGE NOPAGE

ON TABLE PCHOLD FORMAT EXL2K

ON TABLE SET STYLE *
TYPE=REPORT, FONT='Arial', SIZE=8, $
TYPE=ACROSSVALUE, WRAP=1.0, STYLE=BOLD, JUSTIFY=CENTER, $
TYPE=REPORT, LABEL=TOTE, STYLE=BOLD, $
TYPE=REPORT, LABEL=TOTA, STYLE=BOLD, $
TYPE=REPORT, LABEL=TOTP, STYLE=BOLD, $
TYPE=REPORT, LABEL=TOTT, STYLE=BOLD, $
ENDSTYLE
END
-RUN

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


WebFOCUS 7.6.10
Windows
Excel, PDF, HTML
February 16, 2011, 12:56 AM
<FreSte>
It it's probably not what you want, but if you change the output format to EXL97, it does the formatting (as a temp work-around).

-Fred-
February 16, 2011, 09:50 AM
Swamp
FreSte, thanks for the quick reply. You are right EXL97 will fix THAT problem but it introduces a whole set of new problems. I may have to go that route though if no one has any other ideas.


WebFOCUS 7.6.10
Windows
Excel, PDF, HTML
February 16, 2011, 10:10 AM
<FreSte>
I gave it another thought and maybe this could be something to consider:
Dump the FML-data to a HOLD-file and use that for downloading it to EXL2K
(you have to do something with the end-result with the formats of the not-% fields).

-Fred-


DEFINE FILE CAR
  COST/D15 = SALES * DEALER_COST;
END

TABLE FILE CAR
  SUM
    COST/D12.2 AS 'Cost'
  ACROSS HIGHEST SEATS

FOR
COUNTRY
'W GERMANY' LABEL CNE1 OVER
'ITALY' LABEL CNE2 OVER
'ENGLAND' LABEL CNE3 OVER
RECAP TOTE = CNE1 + CNE2 + CNE3; AS 'TOTAL EUROPE' OVER
RECAP TOTP/D10.2 = (CNE1/TOTE) * 100; AS 'W GERMANY % of EUROPE' OVER
'JAPAN' LABEL CNA1 OVER
'TAIWAN' LABEL CNA2 OVER
RECAP TOTA = CNA1 + CNA2; AS 'TOTAL ASIA' OVER
RECAP TOTT = TOTE + TOTA; AS 'TOTAL'
ON TABLE HOLD
ON TABLE SET HOLDLIST PRINTONLY
END
-RUN
-*?FF HOLD
-*-EXIT

TABLE FILE HOLD
  PRINT *
  COMPUTE FLAG/A1 =
    IF E01 CONTAINS 'TOTAL' OR '%' THEN 'Y' ELSE 'N'; NOPRINT
ON TABLE SET STYLE *
TYPE=REPORT, FONT='Arial', SIZE=8, $
TYPE=ACROSSVALUE, WRAP=1.0, STYLE=BOLD, JUSTIFY=CENTER, $
TYPE=DATA, STYLE=BOLD, WHEN=FLAG EQ 'Y' ,$
ENDSTYLE

ON TABLE SET PAGE NOPAGE

ON TABLE PCHOLD FORMAT EXL2K

END
-RUN

February 16, 2011, 10:58 AM
Swamp
Fred, that destroys all of my formatting. What I can do to make one individual cell have the right formatting of bold, 2 decimal places and the percent sign is add this line:
TYPE=REPORT, LABEL=TOTP, COLUMN=N2, STYLE=BOLD, $

The only problem with this idea is that I will need a line of code for N2 through Nx where x is the number of columns. I have 15 columns. I also have about 10 rows like this so I would need 150 (15*10) rows of code to do the workaround unless there is a way to refer to columns N2 through N15 in one line of code.


WebFOCUS 7.6.10
Windows
Excel, PDF, HTML
February 16, 2011, 01:34 PM
<FreSte>
OK, understood.

There is a way however to do it with less code;
You can put the stylesheet coding in a repeat-loop like:

-REPEAT :LB_STYLE1 FOR &I FROM 2 TO 16;
TYPE=REPORT, LABEL=TOTA, COLUMN=N&I, STYLE=BOLD, $
TYPE=REPORT, LABEL=TOTB, COLUMN=N&I, STYLE=BOLD, $
TYPE=REPORT, LABEL=TOTC, COLUMN=N&I, STYLE=BOLD, $
TYPE=REPORT, LABEL=TOTD, COLUMN=N&I, STYLE=BOLD, $
...
... etc etc
...
-:LB_STYLE1



... or (if possible), give the labels in the FEX also a number, then you can do it with much
less code:

-REPEAT :LB_OUTER FOR &I FROM 2 TO 16;
-REPEAT :LB_INNER FOR &J FROM 1 TO 10;
TYPE=REPORT, LABEL=TOT&J, COLUMN=N&I, STYLE=BOLD, $
-:LB_INNER
-:LB_OUTER


But maybe this kind of coding is not applicable for your report.

Cheers,

-Fred-
February 16, 2011, 03:21 PM
Swamp
Fred, that will do it! I had no idea that you could do something like that. Thanks a bunch.


WebFOCUS 7.6.10
Windows
Excel, PDF, HTML