Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Can I put conditions (IF, tags) in a Style Sheet?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Can I put conditions (IF, tags) in a Style Sheet?
 Login/Join
 
Gold member
posted
Is it possible to put conditions inside a style sheet?

Ex:
ON TABLE SET STYLE *
-IF &LOGO EQ 'PDP' THEN GOTO PDPHEAD;
TYPE=TABHEADING,IMAGE=pharmawf.gif,SIZE=(1.5 0.482143),$
-GOTO AFTERH;
-PDPHEAD
TYPE=TABHEADING,IMAGE=pdplogo1.gif,SIZE=(1.74675 0.5),$
-AFTERH
...
ENDSTYLE

I've tried but got no output, is there a way to do something like that?

Thanks.
 
Posts: 87 | Location: Montreal, QC, Canada | Registered: September 03, 2004Report This Post
Platinum Member
posted Hide Post
Hi

Hmmm I am surprised that doesnt work. Why dont you try using variables instead... like this..

-SET &MYSTYLE=IF &LOGO EQ 'PDP' THEN
-'TYPE=TABHEADING,IMAGE=pharmawf.gif,SIZE=(1.5 0.482143),$' ELSE 'TYPE=TABHEADING,IMAGE=pdplogo1.gif,SIZE=(1.74675 0.5),$';

ON TABLE SET STYLE *
&MYSTYLE
ENDSTYLE

Does that work?

Jodye
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Gold member
posted Hide Post
That doesn't work. it's looking for a VALUE for the variable. You can't use a variable that contains a full line of the style sheet code but you can use variables for values ex: PAPER = &PAPERSIZE.

I had to make 2 different style sheets...
 
Posts: 87 | Location: Montreal, QC, Canada | Registered: September 03, 2004Report This Post
Gold member
posted Hide Post
ON TABLE SET STYLE *
TYPE=TABHEADING,WHEN=&LOGO EQ 'PDP', IMAGE=pdplogo1.gif,SIZE=(1.74675 0.5),$
TYPE=TABHEADING,WHEN=&LOGO NE 'PDP', IMAGE=pharmawf.gif,SIZE=(1.5 0.482143),$
...
ENDSTYLE
 
Posts: 90 | Registered: April 15, 2004Report This Post
<Zushi Hitoshi>
posted
I try the following request,then it is no problem.
Dou you have SUBHEAD keyword, or IMAGE= keyword
is correnct?

-SET &LOGO='PXP';
TABLE FILE CAR
PRINT CAR MODEL SEATS
BY COUNTRY
ON TABLE SUBHEAD
" "
ON TABLE SET STYLE *
-IF &LOGO EQ 'PDP' THEN GOTO PDPHEAD;
TYPE=TABHEADING,IMAGE='http://www.accs.co.jp/accwe002.gif',
SIZE=(1.74675 0.5),$
-GOTO AFTERH;
-PDPHEAD
TYPE=TABHEADING,IMAGE='http://www.accs.co.jp/accwe017.gif',
SIZE=(1.5 0.482143),$
-AFTERH
ENDSTYLE
END
 
Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Stan:
[qb] ON TABLE SET STYLE *
TYPE=TABHEADING,WHEN=&LOGO EQ 'PDP',
<snip>[/qb]
Almost. After evalation of &LOGO, the WHEN condition needs to be a "literal vs. literal" comparison (of the string contained in &LOGO to the string "PDP"), so you need to single-quote &LOGO, thus:
...,WHEN='&LOGO' EQ 'PDP', ...,$

Without the tics, TABLE will see (perhaps):
...,WHEN=Vax EQ 'PDP',...,$
and will complain that there is no field named Vax.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
Flip, just to offer you encouragement, it is definitely possible to put dialog manager in style sheets. i do it all day long. Its a very useful technique, so i encourage you to tinker with it to get it to work, for future use. In this case, stan's and jack's when= is certainly the elegant way to go.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Yet another approach:


-DEFAULT &LOGO='???';
-*************************************
-SET &Gfile=DECODE &LOGO('PDP' 'accwe017.gif' ELSE 'accwe017.gif' );
-SET &Gsize=DECODE &LOGO('PDP' '(1.5 0.482143)' ELSE '(1.74675 0.5)' );
-*************************************

TABLE FILE yada
yada
ON TABLE SUBHEAD
" "
ON TABLE SET STYLE *
TYPE=TABHEADING,
IMAGE='http://www.accs.co.jp/&Gfile',SIZE=&Gsize,$
ENDSTYLE
END

This has the advantage of isolating the decision rules and magic constants up front (so they are apparent and maintainable), and avoids cluttering the TABLE code itself with IFs, WHENs, GOTOs or labels.

This message has been edited. Last edited by: <Mabel>,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
Looking back over the thread, I see that this was basically Jodye's idea.

If copying her code resulted in a "missing value" message (meaning an undefined dialog manager variable was referenced), the source is either &LOGO or &MYSTYLE. Two modifications to solve which ever problem:

a. include
-DEFAULT &LOGO=something
to ensure it is defined

b. a dash before each continuation line of the -SET:

-SET &MYSTYLE=IF &LOGO EQ 'PDP'
- THEN 'TYPE=TABHEADING,IMAGE=pharmawf.gif,SIZE=(1.5 0.482143),$'
- ELSE 'TYPE=TABHEADING,IMAGE=pdplogo1.gif,SIZE=(1.74675 0.5),$';

(the forum's rendering of long lines may have been misleading here)

With those changes, it should work.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
Thats exactly what I wrote, but yes it was mangled by the forum wrapping the text and I am sure it will work. Dialogue manager will let you store anything in a variable. We do that all the time.
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Report This Post
Master
posted Hide Post
Try This:


-SET &LOGO='PDP';

DEFINE FILE CAR
LOGO/A3 = '&LOGO';
END
TABLE FILE CAR
PRINT
'COMP.CAR'
'CARREC.MODEL'
'BODY.SEATS'
LOGO NOPRINT
BY
'ORIGIN.COUNTRY'
ON TABLE SUBHEAD
" "
ON TABLE NOTOTAL
ON TABLE SET STYLE *
UNITS=IN,
PAGESIZE='Letter',
LEFTMARGIN=0.250000,
RIGHTMARGIN=0.250000,
TOPMARGIN=0.250000,
BOTTOMMARGIN=0.250000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
DEFMACRO=COND0001,
MACTYPE=RULE,
WHEN=N5 EQ 'PDP',
$
DEFMACRO=COND0002,
MACTYPE=RULE,
WHEN=N5 EQ 'PXP',
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=TABHEADING,MACRO=COND0001,IMAGE='http://www.accs.co.jp/accwe002.gif',
SIZE=(1.74675 0.5),
$
TYPE=TABHEADING,MACRO=COND0002,IMAGE='http://www.accs.co.jp/accwe017.gif',
SIZE=(1.5 0.482143),$
ENDSTYLE
END
Good Luck

This message has been edited. Last edited by: <Mabel>,
 
Posts: 865 | Registered: May 24, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Can I put conditions (IF, tags) in a Style Sheet?

Copyright © 1996-2020 Information Builders