Focal Point
[SOLVED] Identifying a line heading or footing in a report.

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

May 11, 2012, 11:43 AM
gcarterIT
[SOLVED] Identifying a line heading or footing in a report.
To identify a line's position in the heading or footing, you need to include the LINE attribute set equal to the integer position of the line (example: LINE=9). However, if lines are deleted/added to the report, the formatting still applies to whatever becomes the new line 9. Is it possible to identify a line by a variable name so whenever the line positioning changes, that line will still have the same formmatting? In other words, if the current line 9 is the company name, instead of

TYPE=TABHEADING
   LINE=9
   STYLE=BOLD


using

TYPE=TABHEADING
   LINE=companyName 
   STYLE=BOLD


so no matter how the lines shift, if the line named "companyLine" is not deleted, it will always be BOLD, regardless of what it's new integer line position is?

Thanks,
George

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


WebFOCUS 7.6
Windows, All Outputs
May 13, 2012, 04:34 PM
Waz
If you use an amper variable, you can do this.

But you will need to know this prior to the TABLE FILE.

e.g.
-SET &companyName = IF <condition> THEN 9 ELSE 10 ;
.
.
.
TYPE=TABHEADING, LINE=&companyName, STYLE=BOLD, $



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 14, 2012, 10:20 AM
gcarterIT
Hi Waz,

Thanks for the reply. From my readings and your reponse, it appears that
1. "LINE=" must always evaluate to an integer, and
2. I need to know ahead of time on what line companyName will appear.

And there lies the problem. It could be on line 3 today and maybe line 5 tomorrow. Or even worse, fall anywhere inside a of line where nothing else should be BOLD. Where ever it falls I want the formatting to follow, so it will always be BOLD - without me having to manually edit the "TYPE=TABHEADING" section.

This would not be an issue with CSS. Maybe I've reached the limitations of Webfocus. Thanks for trying to help me.

George


WebFOCUS 7.6
Windows, All Outputs
May 14, 2012, 10:56 AM
Wep5622
You can pre-define your heading lines using dialogue manager and enumerate, like so:
-SET &LINE=1;
-SET &LINEREF = '';
-SET &HEADING = '';

-SET &FIELD = 'CompanyName';
-SET &HEADING.&LINE = '"<'|&FIELD|'"';
-SET &LINEREF.&FIELD = &LINE;

-SET &LINE = &LINE +1;
-SET &FIELD = 'CompanyAddress';
-SET &HEADING.&LINE = '"<'|&FIELD|'"';
-SET &LINEREF.&FIELD = &LINE;


For your headings you then use:
HEADING
-SET &I = 1;
-REPEAT :HeadLoop WHILE &i LT &LINE;
"&HEADING.&I"
-SET &I = &I + 1;
-:HeadLoop


Then in your style-sheet, you can reference:
-SET &FIELD = 'CompanyName';
TYPE=DATA, LINE=&LINEREF.&FIELD, STYLE=BOLD,$


I'm not entirely sure whether you could access those variables more directly, such as &LINEREF.CompanyName for example.

Also, this will get even more complicated if you also need to reference the correct column! You'll probably need to find the index of the word in the line using GETTOK or something similar.

A word of warning, this is totally untested. And yes, it ain't pretty Wink


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
May 14, 2012, 02:33 PM
gcarterIT
Wep5622,

Thanks for the brainstorming. When I get a chance, I'll play around with your code.

George


WebFOCUS 7.6
Windows, All Outputs
May 14, 2012, 05:53 PM
Waz
Depending on your version of WebFOCUS, you could use MARKUP.

What controls where this text is ?

MARKUP allows you to embed styling in the data.
e.g.
DEFINE FILE CAR
Country/A20 = IF COUNTRY CONTAINS 'E' THEN '<b>' | COUNTRY | '</b>' ELSE COUNTRY ;
END
TABLE FILE CAR
PRINT COUNTRY
      Country
ON TABLE PCHOLD FORMAT PDF
-*ON TABLE PCHOLD FORMAT EXL2K
-*ON TABLE PCHOLD FORMAT HTML
-*ON TABLE SET NEWLAYOUT ON
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
UNITS=CM, PAGESIZE='A4', LEFTMARGIN=0.635000, RIGHTMARGIN=0.635000,
    TOPMARGIN=0.635000, BOTTOMMARGIN=0.635000,
    SQUEEZE=ON,
    ORIENTATION=LANDSCAPE, $
TYPE=REPORT, COLUMN=P2, MARKUP=ON, $
END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 15, 2012, 08:46 AM
gcarterIT
quote:
What controls where this text is ?


Think of this as a form letter. The user decides where and how the text will appear in the document. This could be a field from a source database or simply customizing the wording for various audiences. For my purposes, I consider it "at random." For now I'm only interested in fixing formatting to static text, not from any data coming from a database table field.

When I get a chance I'll take a closer look at your code and try it out. But for now, it appears doing it manually is the easiest way to go.

Thanks for the ideas,
George


WebFOCUS 7.6
Windows, All Outputs