Focal Point
[SOLVED] ACROSS, COMPUTE AND STYLES

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

April 27, 2010, 11:44 AM
<José Andrés Vargas Aguilar>
[SOLVED] ACROSS, COMPUTE AND STYLES
I have a code similar to this:

DEFINE FILE CAR
SALESD/D10 = SALES;
END
-***************************************
TABLE FILE CAR
SUM SALESD NOPRINT
BY COUNTRY NOPRINT
SUM SALESD NOPRINT
BY COUNTRY NOPRINT
BY CAR
SUM SALESD AS 'Sales'
PCT.SALESD/D6.2 WITHIN COUNTRY WITHIN SEATS AS '%'
BY COUNTRY NOPRINT
BY CAR
ACROSS SEATS
COMPUTE XTOT_SALESD/D15 = C2; AS 'Total'
COMPUTE PCT/D12.2 = C2 / C1 * 100; AS '%'
-***************************************
ON COUNTRY SUBHEAD
"COUNTRY: ON COUNTRY RECOMPUTE AS 'TOTAL'
ON TABLE NOTOTAL
END

My question is: how do you modify the style of the las two compute columns ('Total' and '%') from a stylesheet?

I already tried with all the types I know and found and I only manage to affect the other areas of the report but not that one in particular.

Thanks for the help.

This message has been edited. Last edited by: <José Andrés Vargas Aguilar>,
April 27, 2010, 12:00 PM
Francis Mariani
DEFINE FILE CAR
SALESD/D10 = SALES;
END

TABLE FILE CAR
SUM SALESD NOPRINT
BY COUNTRY NOPRINT
SUM SALESD NOPRINT
BY COUNTRY NOPRINT
BY CAR
SUM SALESD AS 'SALES'
PCT.SALESD/D6.2 WITHIN COUNTRY WITHIN SEATS AS '%'
BY COUNTRY NOPRINT
BY CAR
ACROSS SEATS
COMPUTE XTOT_SALESD/D15 = C2; AS 'TOTAL'
COMPUTE PCT/D12.2 = C2 / C1 * 100; AS '%'

ON COUNTRY SUBHEAD
"COUNTRY: <COUNTRY"
ON COUNTRY RECOMPUTE AS 'TOTAL'
ON TABLE NOTOTAL
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=XTOT_SALESD, COLOR=RED, $
TYPE=REPORT, COLUMN=PCT, COLOR=BLUE, STYLE=BOLD, $
ENDSTYLE
END



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
April 27, 2010, 12:51 PM
<José Andrés Vargas Aguilar>
Thanks Francis, but actually I don't need to edit the results of the compute but the label associated to it. I.e. the 'Total and the '%'.

Thanks!
April 27, 2010, 01:13 PM
<José Andrés Vargas Aguilar>
Here is a copy of my actual code for you to have a better idea.

This solution didn't work. What I need to "style" are the labels from the computes below the across ('Totales', 'Concent.', etc) and not the results itself...


-* *******************************************


TABLE FILE SQLOUT

SUM
MONTOS NOPRINT
CONMORA NOPRINT
MORA30 NOPRINT
CANTIDADES NOPRINT
CANTMORA NOPRINT
CANT30 NOPRINT

SUM
MONTOS NOPRINT
CONMORA NOPRINT
MORA30 NOPRINT
CANTIDADES NOPRINT
CANTMORA NOPRINT
CANT30 NOPRINT

BY &wf_agrupa

SUM
MONTOS AS 'Monto'
CONMORA NOPRINT
MORA30 NOPRINT
CANTIDADES AS 'Cant.'
CANTMORA NOPRINT
CANT30 NOPRINT

BY &wf_agrupa

ACROSS MORAMIN NOPRINT
ACROSS DIA AS 'Dias de Mora'
COMPUTE TVAL/D20.2 = C7; AS 'TOTALES'
COMPUTE TCAN/D20 = C10; AS 'TEST'
COMPUTE PVAL/D20.2% = 100*C7/C1; AS 'CONCENT.'
COMPUTE PCAN/D20.2% = 100*C10/C4; AS ''
COMPUTE CONM/D20.2% = 100*C8/C2; AS 'MORA'
COMPUTE CANM/D20.2% = 100*C11/C5; AS ''
COMPUTE MOR3/D20.2% = 100*C9/C3; AS 'MORA > 30'
COMPUTE CAN3/D20.2% = 100*C12/C6; AS ''

ON TABLE COLUMN-TOTAL

-INCLUDE bkw54/bkwstyleanalisis.fex


-* *******************************************


-* Amongst other stuff I have this on bkw54/bkwstyleanalisis.fex


-* *******************************************


TYPE=REPORT, COLUMN=TCAN, STYLE=BOLD, SIZE=12, BACKCOLOR=YELLOW, COLOR=NAVY,$

-* *******************************************

FYI, I initially thought this labels would be ACROSSTITLE or ACROSSVALUE but they dont get affected by the ACROSSTITLE and ACROSSVALUE definitions I already have.

I used the -HTMLFORM for CSS advice Francis gave me but it didn't do the job either.

Thanks for all the help, I really appreciate it!
April 27, 2010, 01:51 PM
Francis Mariani
José, it appears you want to style the column titles of the COMPUTE columns after the ACROSS columns.

Use TYPE=ACROSSVALUE, COLUMN=:

-*-- jose1

TABLE FILE CAR
SUM
SALES NOPRINT
SEATS NOPRINT
WIDTH NOPRINT
LENGTH NOPRINT
WHEELBASE NOPRINT
WEIGHT NOPRINT

SUM
SALES NOPRINT
SEATS NOPRINT
WIDTH NOPRINT
LENGTH NOPRINT
WHEELBASE NOPRINT
WEIGHT NOPRINT

BY MODEL

SUM
SALES AS 'Monto'
SEATS NOPRINT
WIDTH NOPRINT
LENGTH AS 'Cant.'
WHEELBASE NOPRINT
WEIGHT NOPRINT

BY MODEL

ACROSS COUNTRY NOPRINT
ACROSS BODYTYPE AS 'Dias de Mora'
COMPUTE TVAL/D20.2 = C7; AS 'TOTALES'
COMPUTE TCAN/D20 = C10; AS 'TEST'
COMPUTE PVAL/D20.2% = 100*C7/C1; AS 'CONCENT.'
COMPUTE PCAN/D20.2% = 100*C10/C4; AS ''
COMPUTE CONM/D20.2% = 100*C8/C2; AS 'MORA'
COMPUTE CANM/D20.2% = 100*C11/C5; AS ''
COMPUTE MOR3/D20.2% = 100*C9/C3; AS 'MORA > 30'
COMPUTE CAN3/D20.2% = 100*C12/C6; AS ''

ON TABLE COLUMN-TOTAL

ON TABLE SET STYLE *
TYPE=REPORT, FONT='Arial', SIZE=8, $
TYPE=ACROSSVALUE, COLUMN=TVAL, STYLE=BOLD, SIZE=10, BACKCOLOR=YELLOW, COLOR=NAVY,$
ENDSTYLE
END

This message has been edited. Last edited by: Francis Mariani,


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
April 27, 2010, 01:58 PM
Dan Satchell
It took some experimentation, but this seems to work.

DEFINE FILE CAR
 SALESD/D10 = SALES;
END
-*
TABLE FILE CAR
 SUM SALESD NOPRINT
  BY COUNTRY NOPRINT
 SUM SALESD NOPRINT
  BY COUNTRY NOPRINT
  BY CAR
 SUM SALESD AS 'SALES'
     PCT.SALESD/D6.2 WITHIN COUNTRY WITHIN SEATS AS '%'
  BY COUNTRY NOPRINT
  BY CAR
  ACROSS SEATS
  COMPUTE XTOT_SALESD/D15 = C2; AS 'TOTAL'
  COMPUTE PCT/D12.2 = C2 / C1 * 100; AS '%'
  ON COUNTRY SUBHEAD
   "COUNTRY: <COUNTRY"
  ON COUNTRY RECOMPUTE AS 'TOTAL'
  ON TABLE NOTOTAL
  ON TABLE SET STYLE *
   TYPE=ACROSSVALUE, COLUMN=XTOT_SALESD, STYLE=BOLD, COLOR=RED, $
   TYPE=ACROSSVALUE, COLUMN=PCT, STYLE=BOLD, COLOR=BLUE, $
  ENDSTYLE
END



WebFOCUS 7.7.05
April 27, 2010, 01:59 PM
Francis Mariani
I edited my message at 13:57, correcting my code because I determined that ACROSSVALUE works, even though the COMPUTEc column is not strictly an ACROSS column.


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
April 27, 2010, 02:00 PM
Francis Mariani
Dan, yes, ACROSSVALUE is the answer!


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
April 27, 2010, 02:21 PM
Dan Satchell
Yes, but a minute too late! Maybe I should learn how to type with more than two fingers and one thumb?


WebFOCUS 7.7.05
April 27, 2010, 02:39 PM
<José Andrés Vargas Aguilar>
Guys, I'm terribly sorry to say this but it doesn't work.

I've been doing some testing myself and found out that whats inhibits both your codes is this set:

ON TABLE SET HTMLCSS ON

The easy thing would be to comment it but when doing so I loose the format of other stuff in my report.

At the end I did this really ugly trick:

ACROSS DIA AS 'Dias de Mora'
   COMPUTE TVAL/D20.2 = C7; AS '<style type="text/css">< !--b{ background-color:#93ACDB; font-size:10px; font-face:arial; text-align:center; color:#FFFFFF; border-top: 1.00pt RIDGE #808080; border-bottom: NONE; border-right: NONE; border-left: 1.00pt RIDGE #808080; }--></style>[b]<font color=#93ACDB>__</font>TOTALES<font color=#93ACDB>__</font>[/b]'
   COMPUTE TCAN/D20 = C10; AS ''
   COMPUTE PVAL/D20.2% = 100*C7/C1; AS '[b]<font color=#93ACDB>__</font>CONCENT.<font color=#93ACDB>__</font>[/b]'
   COMPUTE PCAN/D20.2% = 100*C10/C4; AS ''
   COMPUTE CONM/D20.2% = 100*C8/C2; AS '[b]<font color=#93ACDB>__</font>MORA<font color=#93ACDB>__</font>[/b]'
   COMPUTE CANM/D20.2% = 100*C11/C5; AS ''
   COMPUTE MOR3/D20.2% = 100*C9/C3; AS '[b]<font color=#93ACDB>__</font>MORA<font color=#93ACDB>_</font>><font color=#93ACDB>_</font>30<font color=#93ACDB>__</font>[/b]'
   COMPUTE CAN3/D20.2% = 100*C12/C6; AS ''


Which gives to the labels the styling I need. That would make it for the day.

Still, for some reason my boss wants it to be styled without making a direct reference to the column nor editing the label itself. In that fashion we could reuse the style file for other fex's without editing a fex's ACROSS-COMPUTE labels every time.

My guess is... that isn't possible, for this particular case.
What do you think?

Thanks for all your support!
April 27, 2010, 02:49 PM
Dan Satchell
When I add ON TABLE SET HTMLCSS ON to the code, there is no change in the output and the COMPUTE column titles are still styled.


WebFOCUS 7.7.05
April 27, 2010, 05:51 PM
Francis Mariani
quote:
I've been doing some testing myself and found out that whats inhibits both your codes is this set:

ON TABLE SET HTMLCSS ON


This is the danger of not telling us evrything up front - Dan and I have provided several working examples to your problem. Every time we post a solution, you add another twist. This gets a bit annoying.

The best way to get a proper answer is to create a fex we can all run - using Car, Gotham Grinds or Century Sales data sources. This fex should contain ALL the peculiarities of your real world program.

If you set HTMLCSS to ON, then you shouldn't be using CLASS= - it's not a good idea to mix the two. My preference is to NOT use HTMLCSS ON, and use CLASS= instead. You will have control over everything by assigning classes to each report component: headings, column titles, data, etc.


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
April 27, 2010, 05:55 PM
Francis Mariani
TABLE FILE CAR
SUM
LENGTH NOPRINT
WIDTH NOPRINT
SUM
SALES
ACROSS COUNTRY

COMPUTE COL1/D15.2 = C1 / C2;

ON TABLE HOLD AS H001 FORMAT HTMTABLE
ON TABLE SET STYLE *
TYPE=ACROSSVALUE, COLUMN=COL1, CLASS= x64, $
ENDSTYLE
END
-RUN

-HTMLFORM BEGIN
<html>
<head>
<TITLE>WEBFOCUS REPORT</TITLE>
<style type="text/css">
.x64 { font-family:ARIAL; font-size:7pt; font-weight:bold; color:#FFFFFF; background-color:#93ACDB; text-align:center;
border-top: 1.00pt RIDGE #808080; border-bottom: NONE; border-right: 1.00pt RIDGE #808080; border-left: 1.00pt RIDGE #808080; }
</style>
</head>
<BODY>
!IBI.FIL.H001;
</BODY>
</html>
-HTMLFORM END




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
April 27, 2010, 06:24 PM
<José Andrés Vargas Aguilar>
Thanks for all the help to both of you.

This issue is oficially over.

I'm disabling HTMLCSS, not using CLASS and using the ACROSSVALUE option you showed a few posts ago. Why? Because this report must work not only on HTML but also on PDF and XLS. And PDF doesn't support CSS.

Now I'll see how to get borders on the HEADING, which would be the only unsolved point. For this I plan to open a new thread if I don't manage to find the reason of it not working.

Francis, I'll consider your recomendations for future posts about creating a fex we can all use with a common data source that includes all the peculiarities of my problem. Thanks!