Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] STY files and variables
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] STY files and variables
 Login/Join
 
Virtuoso
posted
I'm attempting to create table footers with different layout & formatting, depending on a global setting variable. So far I've run into limitations at every angle I've tried. The intent is to be able to change what type of footer I get under a report by changing a single variable and without requiring report creators to include a gazillion different files to get the desired result.

I thought I was on the right path, but maybe not...

My procedure looks like this:
-* Global footer type setting
-SET &FOOTERTYPE = 'LINE';

-* This is in an include actually
-********************************
-* As an aside; Does this really need to be done with GOTO's? It seems so clumsy...
-IF &FOOTERTYPE EQ 'BLOCK' THEN GOTO FTBLOCK;
-IF &FOOTERTYPR EQ 'LINE' THEN FOTO FTLINE;
-GOTO FTNONE;

-* A block-model footer
-FTBLOCK
-SET &FF_LINE    = '-*';
-SET &FF_BLCK    = '-INCLUDE footing_block.ftm';
-GOTO FTEND

-* A single-line footer
-FTLINE
-SET &FF_LINE	= '-INCLUDE footing_line.ftm';
-SET &FF_BLCK	= '-*';
-GOTO FTEND

-FTNONE
-SET &FF_LINE    = '-*';
-SET &FF_BLCK    = '-*';
-GOTO FTEND

-FTEND
-* Until here
-********************************

TABLE FILE CARS
BY NAME
WHERE RECORDLIMIT EQ 25;
ON TABLE PCHOLD FORMAT HTML
&FF_BLCK.EVAL
&FF_LINE.EVAL
ON TABLE SET HTMLCSS OFF
ON TABLE SET CSSURL 'report.css'
ON TABLE SET STYLE *
     INCLUDE = footing_test,
$
ENDSTYLE
END


My stylesheet attempts to use conditional formatting based on the &FOOTERTYPE variable, but it seems that variables in STY-files don't get expanded? Anyway, here's the style definition (footing_test.sty):
TYPE=FOOTING, CLASS=FOOTING, WHEN=&FOOTERTYPE NE 'LINE',$
TYPE=FOOTING, CLASS=FOOTING center, WHEN=&FOOTERTYPE EQ 'LINE',$

TYPE=FOOTING, ITEM=1, WIDTH=3,		WHEN=&FOOTERTYPE EQ 'BLOCK',$
TYPE=FOOTING, ITEM=2, WIDTH=0.5,	WHEN=&FOOTERTYPE EQ 'BLOCK',$
TYPE=FOOTING, ITEM=3, WIDTH=5,		WHEN=&FOOTERTYPE EQ 'BLOCK',$

TYPE=FOOTING, LINE=1, ITEM=2, JUSTIFY=CENTER, WIDTH=1, WHEN=&FOOTERTYPE EQ 'LINE',$
TYPE=FOOTING, LINE=1, ITEM=4, JUSTIFY=CENTER, WIDTH=1, WHEN=&FOOTERTYPE EQ 'LINE',$
TYPE=FOOTING, LINE=1, ITEM=6, JUSTIFY=CENTER, WIDTH=1, WHEN=&FOOTERTYPE EQ 'LINE',$


A typical footer include-file (this is the 'LINE' variant) looks like:
FOOTING
"User : &UID<+0>&|mdash;<+0>Report printed : &DATEDMYY<+0>&|mdash;<+0>Report name : &FOCFEXNAME"


I think you get the drift of what I'm trying to do here, any ideas on how to get the desired result?

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


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 :
 
Posts: 1643 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
You can "not" use Dialogue Manager variables to conditionally style, it has to be a column stored in the request matrix.

We can never test your code because we don't have a CARS file. Please use the IBISAMP data sources and replicate your problems with that. To access these sources, see the 1st 2 lines in the code below.

This code will conditionally style, change LINE to BLOCK to see how it works:

  
APP APPENDPATH IBISAMP
-RUN

-SET &FOOTERTYPE = 'LINE';

DEFINE FILE CAR
  FLAG1/A1 = IF '&FOOTERTYPE.EVAL' EQ 'BLOCK' THEN 'Y' ELSE 'N'; 
  FLAG2/A1 = IF '&FOOTERTYPE.EVAL' EQ 'LINE'  THEN 'Y' ELSE 'N'; 
END
TABLE FILE CAR
SUM
   CAR
   RETAIL_COST
   DEALER_COST
   FLAG1 NOPRINT
   FLAG2 NOPRINT
  BY COUNTRY
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=N2, BACKCOLOR='LIGHT BLUE', WHEN=FLAG1 EQ 'Y',$ 
TYPE=DATA, COLUMN=N2, COLOR='RED',            WHEN=FLAG2 EQ 'Y',$  
 
ENDSTYLE
END
-EXIT


hth

For the clumsy code:
quote:

-* This is in an include actually
-********************************
-* As an aside; Does this really need to be done with GOTO's? It seems so clumsy...

  
-DEFAULT &FOOTERTYPE = 'NONE'

-GOTO FT&FOOTERTYPE
-*IF &FOOTERTYPE EQ 'BLOCK' THEN GOTO FTBLOCK;
-*IF &FOOTERTYPR EQ 'LINE' THEN FOTO FTLINE;
-*GOTO FTNONE;

-* A block-model footer
-FTBLOCK
-SET &FF_LINE    = '-*';
-SET &FF_BLCK    = '-INCLUDE footing_block.ftm';
-GOTO FTEND

-* A single-line footer
-FTLINE
-SET &FF_LINE	= '-INCLUDE footing_line.ftm';
-SET &FF_BLCK	= '-*';
-GOTO FTEND

-FTNONE
-SET &FF_LINE    = '-*';
-SET &FF_BLCK    = '-*';
-GOTO FTEND

-FTEND
-* Until here
-********************************


Tom Flynn
WebFOCUS 7.7.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1946 | Location: Parker, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
In addition to Tom's suggestion and if you don't particularly like the use of GOTO, you can attempt something like:

-DEFAULTS &FOOTERTYPE = 'NONE';

-SET &FOOTERINC = IF &FOOTERTYPE EQ 'LINE' THEN '-INCLUDE footing_line.ftm' ELSE
-                 IF &FOOTERTYPE EQ 'BOCK' THEN '-INCLUDE footing_block.ftm' ELSE '-*';
-********************************


Then in your report request:

TABLE FILE blah
...
ON TABLE PCHOLD FORMAT HTML
&FOOTERINC.EVAL
...
END


The example above assumes that you either have a line footing -or- a block footing -or- none at all but *never* both, so there's no need to use 2 & variables.

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.
 
Posts: 1533 | Registered: August 12, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Tom Flynn:
You can "not" use Dialogue Manager variables to conditionally style, it has to be a column stored in the request matrix.

We can never test your code because we don't have a CARS file. Please use the IBISAMP data sources and replicate your problems with that. To access these sources, see the 1st 2 lines in the code below.


Aha, so that's how to access the sample data. I figured it would need to be among our projects somewhere, but apparently that's not needed. Thanks for the pointer.

Too bad about the first part of your reply though, there's no way to guarantee that our report editors apply that to their reports Frowner
I get the impression that approach would get a little complicated once ACROSS or OVER columns enter the picture, plus, it could break if they add extra columns to their reports too.

I'll probably end up conditionally including different footer style files, instead of using conditional styling. That was a bit of a workaround to avoid the extra files to include by the editors to begin with, but if they have to add code to each report anyway then it'd better be something easy Wink
I think I may be able to add that to the ftp-file though. Then at least new reports will get this automatically.

quote:

For the clumsy code:
  
-DEFAULT &FOOTERTYPE = 'NONE'

-GOTO FT&FOOTERTYPE


Of course! Good trick, I'll certainly remember that one, thanks.


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 :
 
Posts: 1643 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
This is just a suggestion: I never use STY files - I put the styling in a FEX and include the FEX. You cannot have Dialogue Manager code in STY files, which makes them quite inflexible.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] STY files and variables

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.