Focal Point
[CLOSED] Including a style sheet with an &var

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

April 03, 2014, 04:28 PM
J.L. Hinds
[CLOSED] Including a style sheet with an &var
I have the following line in all of one customer's fex files for a dashboar

&STYLE

This line shows the following in the debug mode

INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/blue.sty,$

I get the following error

(FOC3294) CANNOT OPEN INCLUDED STYLESHEET AT LINE 56:
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/blue.sty

When I copy the line from debug into the code overwriting the &STYLE line it runs perfectly.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6
Windows, All Outputs
April 04, 2014, 05:28 AM
Tony A
I think that you would need to use &STYLE.EVAL to ensure the variable was resolved pre-parsing.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
April 04, 2014, 08:17 AM
j.gross
That (.EVAL) should make no difference. Either way, the text associated with &STYLE gets appended to FOCSTACK.

I am not sure how IBFS:/FILE references work. But if that syntax must be intercepted by MR and converted to an alternative form that the reporting server can understand, that would explain why this fex failed: When you hide syntax in a &var, you deprive MR's static code analysis of the opportunity to parse and modify it.
April 04, 2014, 08:35 AM
Tony A
I agree Jack, it should make no difference. However, I have seen before that using &variables to include an external reference such as this appears OK in the trace but hasn't been available at the time of parsing the source and therefore the error of file can not be found is generated.

At least it's worth a shot to remove the doubt.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
April 04, 2014, 02:59 PM
j.gross
If it's a fex in the MR repository, there are three participants in the process:



The proof of the pudding (as to whether MR modifies the INCLUDE's IBFS: reference) would be to compare the &ECHOs when using &STYLE and when it's hard-coded.

This message has been edited. Last edited by: j.gross,
April 04, 2014, 11:39 PM
Francis Mariani
haven't been able to do variable-based includes in many a year. must use -GOTO to the appropriate -INCLUDE...


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
April 05, 2014, 01:33 PM
J.L. Hinds
We're trying to use a demonstration dashboard for confrences. I'd like to be able to switch the style from one presentation to the next so the customers color scheme will be shown. I tried using a -set &stylevar='style sheet line';$ copied from the code. This is also returning the same error as before. Has anyone come up with a way to select a style this way?


WebFOCUS 7.6
Windows, All Outputs
April 06, 2014, 11:30 AM
j.gross
Then I suggest you sidestep the issue.

Dream up your own name for the file (e.g., conference.sty), and replace the file before each session with a copy of the appropriate .sty file for the respective audience. That way, your application code (including the INCLUDE line) will be static. If you create a set of cmd scripts to handle the details, there will be less that can go wrong, especially if you need to toggle several such file references...


BUT I am still curious to know whether the lines of code in the STYLE section ECHO'ed by the reporting server are identical or different, when you use

&STYLE
(with &STYLE set to 'INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/blue.sty,$')

vs. when you hard-code

INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/blue.sty,$

Let us know.

This message has been edited. Last edited by: j.gross,
April 07, 2014, 02:03 AM
Dave
....or
fix it within the .sty


-IF &CUSTOMER EQ 'A' THEN CONTINUE ELSE ENDIF_CUSTOMER_A;

...stylesheetcode here

-ENDIF_CUSTOMER_A

-IF &CUSTOMER EQ 'B' THEN CONTINUE ELSE ENDIF_CUSTOMER_B;

...stylesheetcode here

-ENDIF_CUSTOMER_B


G'Luck


_____________________
WF: 8.0.0.9 > going 8.2.0.5
April 08, 2014, 01:47 PM
J.L. Hinds
The suggestions to copy the style sheet to a common name or to handle it in the code would both work. My only issue would be that I may have a few dozen style sheets. The following code does not work for me but runs fine if I take the -* off the INCLUDE = endeflt,$

-SET &NEWSTYLE='INCLUDE = endeflt,$';
TABLE FILE CAR
BY CAR.ORIGIN.COUNTRY
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE &NEWSTYLE
-* INCLUDE = endeflt,$
ENDSTYLE
END


WebFOCUS 7.6
Windows, All Outputs
April 09, 2014, 11:57 AM
j.gross
quote:
-SET &NEWSTYLE='INCLUDE = endeflt,$';
TABLE FILE CAR
(snip)
ON TABLE SET STYLE *
INCLUDE &NEWSTYLE
ENDSTYLE
END


After the substitution, the &ECHO should show

INCLUDE INCLUDE = endeflt,$


Why would you think that would "work"?
April 09, 2014, 12:59 PM
Jay Potter
is your style sheet in mre? I had a similair issue, when i copied the style sheet into an application folder it worked. For some reason it seems to only look on the reporting server.

Actually after looking at my code closer and wasn't for a stylesheet but for a fex. But it could be a similair issue.

Here is the code I used.

 

-SET &ADDITIONAL_INCLUDE = 'portal_accounting_customer_aging_summary_column_alignment.fex' ;

-IF &ADDITIONAL_INCLUDE EQ '' GOTO AFTER_INCLUDE_ADDITIONAL ;

-MRNOEDIT -INCLUDE &ADDITIONAL_INCLUDE.EVAL

-AFTER_INCLUDE_ADDITIONAL
 



WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
April 09, 2014, 03:17 PM
j.gross
The question in my mind was, and still is: is the reporting server ever able to interpret a reference of the form IBFS:/...
-- or is that syntax strictly intended for consumption by the "client" side (i.e. MR)?

If the latter, MR must do something to transform
INCLUDE = ibfs:/file/ ... ,$
into a reference (or expansion in-place) that is digestible by wfs ("server"). And it would explain why using an amper variable to insert a correct-looking INCLUDE=IBFS:/... reference does not work.

Can anyone contribute an authoritative answer, yea or nay?


- Jack Gross
WF through 8.1.05
April 10, 2014, 10:09 AM
J.L. Hinds
J.Gross
The double include was bad timing as I forgot that I was testing some thing right before I copied it. I'm going to keep plugging away but I have yet to find a solution.

Thanks for all the advice.


WebFOCUS 7.6
Windows, All Outputs
April 10, 2014, 11:04 AM
Francis Mariani
As I previously mentioned, using amper variables in INCLUDE statements hasn't worked reliably in a very long time, EVAL or not EVAL. It's probably even more difficult in v8.

I've used -GOTO statements, *something* like:

...

-GOTO LABEL_&COMPANY

-LABEL_COMP1
-INCLUDE baseapp/stylecomp1.sty
-GOTO LABEL_END

-LABEL_COMP2
-INCLUDE baseapp/stylecomp2.sty
-GOTO LABEL_END

-LABEL_COMP3
-INCLUDE baseapp/stylecomp3.sty
-GOTO LABEL_END

-LABEL_END

...

(You'll have to make sure you have a label for every possible &COMPANY value - you could generate these lines using a Dialogue Manager loop).



"We're trying to use a demonstration dashboard for conferences"

An alternative to the above method would be to programmatically copy a specific style file to a generic file, using the APP COPYFILE command or an OS command.

Something like:

...

APP COPYFILE baseapp/style&COMPANY FOCSTYLE baseapp/style FOCSTYLE DROP

...

-INCLUDE baseapp/style.sty

...



Another method would be to store the style sheet for each company in a different folder, then use APP MAP to add the folder to the application path.

Create folders like these:

C:\ibi\apps\comp1, C:\ibi\apps\comp2, C:\ibi\apps\comp3, etc.

Store the style sheet for each company in the appropriate folder, each having the same file name.

Map the appropriate folder, then include the style file.

Something like this:

APP MAP WFSTYLE C:\ibi\apps\&COMPANY
-RUN

...

-INCLUDE wfstyle/style.sty

...



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
April 10, 2014, 11:12 AM
Francis Mariani
Modify the code appropriately for WF 8.


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