|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Gold member |
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. |
||
|
|
Platinum Member |
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 |
|||
|
|
Gold member |
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... |
|||
|
|
Gold member |
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 |
|||
|
|
Member |
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 |
|||
|
|
Master |
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. |
|||
|
|
Expert |
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.
|
|||
|
|
Master |
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>, |
|||
|
|
Master |
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. |
|||
|
|
Platinum Member |
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.
|
|||
|
|
Master |
Try This:
-SET &LOGO='PDP'; DEFINE FILE CAR LOGO/A3 = '&LOGO'; END TABLE FILE CAR '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>, |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

