Focal Point
[SOLVED] Last two rows of data to be bold

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

June 11, 2010, 11:24 AM
bflemi3
[SOLVED] Last two rows of data to be bold
Hi all,

How do I identify the last two rows of data in my style sheet? I need to make the last two rows bold. Is this possible?

Thanks in advance,
B

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


WebFOCUS 7.7
Windows
All Output (Excel, HTML, PDF)
June 11, 2010, 12:07 PM
atturhari
Hope this will help u,

TABLE FILE CAR
PRINT CAR
COUNTRY
ON TABLE HOLD
END

-SET &LAST_ROW = &LINES;
-SET &PENUL_ROW = &LAST_ROW - 1;

TABLE FILE CAR
PRINT CAR
COUNTRY
COMPUTE RANK/I2 = RANK + 1; NOPRINT
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE = DATA, STYLE=BOLD, WHEN = RANK EQ &PENUL_ROW,$
TYPE = DATA, STYLE=BOLD, WHEN = RANK EQ &LAST_ROW,$
END

-Hari


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
June 11, 2010, 02:46 PM
njsden
What is so particular about those 2 rows of data when compared to the rest of the data in your report? Are they sub-totals or totals? or .. is there "something" in there that would allow to clearly differentiate them from other rows in the same data set?



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
June 11, 2010, 03:43 PM
bflemi3
They are the totals for the particular region the user selected and the total for the company. I had to create 3 hold files and then used MORE to join all three hold files together. Now I need to format the report so the last lines are bold.


WebFOCUS 7.7
Windows
All Output (Excel, HTML, PDF)
June 11, 2010, 03:45 PM
bflemi3
quote:
Originally posted by atturhari:
Hope this will help u,

TABLE FILE CAR
PRINT CAR
COUNTRY
ON TABLE HOLD
END

-SET &LAST_ROW = &LINES;
-SET &PENUL_ROW = &LAST_ROW - 1;

TABLE FILE CAR
PRINT CAR
COUNTRY
COMPUTE RANK/I2 = RANK + 1; NOPRINT
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE = DATA, STYLE=BOLD, WHEN = RANK EQ &PENUL_ROW,$
TYPE = DATA, STYLE=BOLD, WHEN = RANK EQ &LAST_ROW,$
END

-Hari


Thanks Hari,

I'm not seeing the formatting change. What is RANK supposed to represent? The row number?


WebFOCUS 7.7
Windows
All Output (Excel, HTML, PDF)
June 11, 2010, 05:15 PM
njsden
What's in each HOLD file? Do you have something like this?

HOLD1: Detailed records
HOLD2: Total for the Region
HOLD3: Total for the Company

If so, you can define a special field to keep some sort of record type indicator which can later be used in your style sheet.

Something like:
FILEDEF HOLDFINAL DISK holdfinal.ftm (APPEND
-RUN
SET HOLDLIST=PRINTONLY
SET ASNAMES=ON
-*
-* 1. Send detail records to resulting HOLD file
DEFINE FILE HOLD1
REC_TYPE/A10 = '1DETAIL';
END
TABLE FILE HOLD1
SUM FIELD1
    FIELD2
    FIELD3
    ...
BY REC_TYPE   <-- Record type indicator
BY ...
ON TABLE HOLD AS HOLDFINAL
END
-*
-* 2. Add region total to resulting HOLD file
DEFINE FILE HOLD2
REC_TYPE/A10 = '2TLREGION';
END
TABLE FILE HOLD2
SUM FIELD1
    FIELD2
    FIELD3
    ...
BY REC_TYPE
BY ...
ON TABLE HOLD AS HOLDFINAL
END
-*
-* 3. Add company total to resulting HOLD file
DEFINE FILE HOLD3
REC_TYPE/A10 = '2TLCOMPANY';
END
TABLE FILE HOLD3
SUM FIELD1
    FIELD2
    FIELD3
    ...
BY REC_TYPE
BY BYFIELD1
BY BYFIELD2
BY ...
ON TABLE HOLD AS HOLDFINAL
END
-RUN


Now you have a file (HOLDFINAL) with all of the information you need. You can then create a report and style it according to REC_TYPE:

TABLE FILE HOLDFINAL
PRINT FIELD1
      FIELD2
      FIELD3
      ...
BY REC_TYPE NOPRINT
BY BYFIELD1
BY BYFIELD2
BY ...
ON TABLE SET STYLE *
...
TYPE=DATA, STYLE=+BOLD, WHEN=REC_TYPE NE '1DETAIL', $
....
ENDSTYLE
END




Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
June 11, 2010, 05:18 PM
njsden
You don't specify how HOLD1, HOLD2 and HOLD3 were created in the first place but if you can control it, it would be preferable to create the REC_TYPE field *while* creating those HOLD files. If you do that, you can then use MORE (instead of the technique I showed above) making sure that REC_TYPE is included in the resulting HOLD file.

The style definition would remain the same.

Hope that helps!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
June 14, 2010, 02:53 PM
Francis Mariani
bflemi3, Attuhari's example works for me - the last two lines are in bold . Just remove the NOPRINT from the RANK computation and you'll see that it is indeed a row number.


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
June 15, 2010, 05:13 PM
Darin Lee
If those lines are just total lines, you should use
BY fieldname
ON fieldname SUB-TOTAL

SUBTOTAL is one of the componenets that can be styled:
TYPE=SUBTOTAL, BY=fieldname, STYLE=BOLD,$


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat