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     [SHARING] unable to dynamically include a file from an amper in MR
Go
New
Search
Notify
Tools
Reply
  
[SHARING] unable to dynamically include a file from an amper in MR
 Login/Join
 
Platinum Member
posted
Hi

This is more of an FYI ...

In WF8, includes to a fex in MR must contain a full path.

eg

-INCLUDE /WFC/Repository/DOMAIN_NAME/whatever.fex

if you omit the /WFC/Repository/DOMAIN_NAME/ part you will get fex not found. This was not the case in WF7. -include x.fex would find x as long as it was in the same domain.

Imagine you have a dev domain and a prod domain and you have includes all over the place. I was hoping to build a string with the path and then do something like

-*in a global inc
-set &path='/WFC/Repository/DOMAIN_NAME/';

-set &whatever=&path || 'whatever.fex';
-INCLUDE &whatever

so whether dev or prod, the same code will work everywhere. But unfortunately it is impossible to inlcude a file with a string in an amper. I never tried this in WF7 since there was no need. But it definitely does not work in wf8.

So... I am finding myself using GOTOS everywhere


-IF &CUR_SITE EQ 'DEV' THEN GOTO INC_DEV1 ELSE GOTO INC_PROD;
-INC_DEV1;
-INCLUDE /WFC/Repository/DEV/whatever.fex
-GOTO INC_DEV1_DONE
-INC_PROD;
-INCLUDE /WFC/Repository/PROD/whatever.fex
-INC_DEV1_DONE;

Ugly! Am I missing something?

Jodye

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


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I don't know much about the way the new "path" works in WebFOCUS 8 or what to do so relative path references work.

what I know for sure is that using &variables to make dynamic -INCLUDE's has never been supported on the MRE side because of the way the Dialogue Manager parser operates there.

-INCLUDE &whatever is only supported at the Reporting Server side.



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
Platinum Member
posted Hide Post
That is true.

The issue is that now that we need the fully qualified path it makes for REALLY ugly gotos everywhere since we need to use a different path depending on where we are.

consider this as a basic example. You have a dev domain and a prod domain with identical code except for one amper that is hard coded to dev or prod. Then you have an include to get some titles in french or english. This is how it looks

-*lang could be 'en' or 'fr'
-*SITE COULD BE DEV OR PROD

-IF &SITE EQ 'PROD' THEN GOTO DO_PROD;

-IF &LANG EQ 'FR' THEN GOTO DO_FR;
-INCLUDE /WFC/Repository/DEV/TITLES_EN.fex
-GOTO ALL_DONE;
-DO_FR;
-INCLUDE /WFC/Repository/DEV/TITLES_FR.fex
-GOTO ALL_DONE;

-DO_PROD;
-IF &LANG EQ 'FR' THEN GOTO DO_FR2;
-INCLUDE /WFC/Repository/PROD/TITLES_EN.fex
-GOTO ALL_DONE;
-DO_FR2;
-INCLUDE /WFC/Repository/PROD/TITLES_FR.fex

-ALL_DONE;


wouldn't it be much nicer to do

-SET &INC='/WFC/Repository/' || &SITE || '/TITLES_' || &LANG || '.fex';
-INCLUDE &INC


I have reports that are using a ton of includes so that branching is all over the place.

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
Jodye,

Have you tried it with .EVAL?
-SET &INC='/WFC/Repository/' || &SITE || '/TITLES_' || &LANG || '.fex';
-INCLUDE &INC.EVAL

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5637 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi Tony

Yes. Does not work. Confused

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Jodye, We are migrating to WF8.02; this is working. Might try this:
-MRNOEDIT BEGIN
-SET &INC='/WFC/Repository/' || &SITE || '/TITLES_' || &LANG || '.fex';
-INCLUDE &INC

or

-INCLUDE &INC.EVAL

-MRNOEDIT END


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1960 | Location: Centennial, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Jodye,
In the architecture we are building, all the Main Focexec's are in the Domain that the user is running the program from.
-INCLUDE files, within the main calling focexec, are in an Application folder that is part of the APP PATH. This way, multiple Domains can use them.
We use -MRNOEDIT BEGIN and END for every fex to bypass the MRE parser for the program's on the server.
Our HTML fex's that populate the Forms are in MRE, and, there are no issues there.
FYI...
Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1960 | Location: Centennial, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi Tom

I want to keep all of the files in MR in one place and not use fexes in the app path. Otherwise we will have half of our code in MR and half in the app path. So for our purposes it looks like there is no way to build a string and include a file from the string in MR.

IMHO the fully qualified path should not be necessary. Or at least, wf should be smart enough to check the current domain where the include is coming from if the fully qualified path is not specified.

Thanks

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Reply With QuoteReport This Post
Master
posted Hide Post
Hi, Tom and Jodye.

I'm following your discussion.

As far as I know, it's not possible what you are trying to do.

remember.
The -INCLUDES are done BEFORE all other DM commands ( at least, that's what I'm told ).

Sample
a.fex
-IF &PARAM EQ 'A' THEN CONTINUE ELSE GOTO -ENDIF_A;
-INCLUDE app/this_fex_doesnt_exist.fex
-ENDIF_A;


What WF does is first "replace" the code "-INCLUDE app/this_fex_doesnt_exist.fex" with the contents of that .fex and then run the code.

Bases on this ( to my best knowledge ) you can not do dynamic includes.

( Other focalpointer, please add info here ).



There is just a little bit of evidence that counters my statement. If a fex is included and within this fex the same label names are use, they're are not mixed up with the 'parent' fex.
( but there are several possible technical solutions IBI could have implemented to prevent this. e.g. prefixing all labels with unique fex-id or name ).

G'luck.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Jodye,
Seems it has to be the "entire" path with MRNOEDIT:
-MRNOEDIT -INCLUDE IBFS:/YourServer/WFC/Repository/YourDomain/YourFocexec.fex

Try this and let us know...

I created a simple fex, an INCLUDE to call it, and, HTML Submit button to call the INCLUDE.
Seemed to work for my simple test...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1960 | Location: Centennial, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
i remember having gotten around icky -INCLUDE issues in times past by making the &var include the -INCLUDE
so its the whole shootin' match.
-SET &thing = '-INCLUDE /WFC/Repository/' || &SITE || '/TITLES_' || &LANG || '.fex';
&thing.EVAL

try that.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi Guys

Tom: That does not seem to work. when I specify the entire path including "IBFS:.." I get
  
  <entry key="REASON" value="invalid character found in path element;
 {INVALID_CHARACTER}={':'}; {AT_INDEX}={11}" /> 

So it does not like the colon.

Susanah: I tried that already. It does not work unfortunately.

I think there is no getting around this. I will just need a bunch of gotos to decide which include to use. I wish that we did not need the fully qualified path. This issue will for sure come up again as more people start going to wf8. I know many places that have dev and prod domains and assume that INCLUDE X.fex will find the correct file.

Thanks all

Jodye


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Reply With QuoteReport This Post
Expert
posted Hide Post
I tried this, but it doesn't work either.

-SET &ECHO=ALL;

-DEFAULT &MR_DOMAIN = 'manageme';

FILEDEF MRINCLUDE DISK mrinclude.fex
-RUN

-WRITE MRINCLUDE -INCLUDE &MR_DOMAIN/app/sparkline4.fex
-CLOSE MRINCLUDE

-MRNOEDIT -INCLUDE mrinclude.fex


It seems the include within the -MRNOEDIT -INCLUDE cannot be an MRE 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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Platinum Member
posted Hide Post
This should work for a relative path in WF8 Repository:

 -INCLUDE ./includee.fex 


where includee.fex is in the same folder. It worked in my 8.0.01M.

I hope this will address most or all of the situations under discussion.


WF 8.2.06
Win10 / IE11
AHTML EXL2K PDF
 
Posts: 147 | Registered: October 19, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
I hope this will address most or all of the situations under discussion.

How so? How does this help in including a variable named fex? Perhaps an example will help me understand.

Thanks,


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
Silver Member
posted Hide Post
OK, it won't help with the variable named fex -- don't think you can get around that. I was thinking the variable named fex was suggested as a way of resolving the issue in the original post. I should have said I was referencing the original post, not "all situations under discussion."

I hope this can address jodye's issue.

Thanks for helping clarify that.

Dave


WF 8.2.03
Win10 / IE11 / Chrome
HTML EXL2K PDF et. al.
 
Posts: 34 | Registered: October 15, 2012Reply With QuoteReport This Post
Expert
posted Hide Post
David, thanks - that does appear to solve the problem mentioned in the original post. I will keep in in my memory bank.


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
Gold member
posted Hide Post
Hi guys,

I'm not 100% sure if this will help. As we are all more or less aware - WF does not really support a variable named fex.
~ Reason: it does not get sent from MRE to RepServ. as the fex was not yet parsed. And RepServ. does not request (included) fexes from MRE afterwards, right?!

But in jodye's case - it is not completely necessary to have a "complete dynamic" include function - a semi dynamic would suffice, right. "Semi dynamic" as in - we previously know the list of fexes we possibly include, but we do not want to choose via ugly -IF GOTO statements.

I don't have access to a WF8 env but the following code works for me in WF7.7:

 
-* include all pre-known fexes here that might be used later. 
-* see it as a "pre-declaration" of fexes (like variables in pascal)
-GOTO L_DONT_INCLUDE;
  -INCLUDE app/test_semi_dynamic0.fex
  -INCLUDE app/test_semi_dynamic1.fex
  -INCLUDE app/test_semi_dynamic100.fex
-L_DONT_INCLUDE

-DEFAULT &INCLUDE_SELECTOR = 0;
-SET &INCLUDE_FEX_NO = DECODE &INCLUDE_SELECTOR(0 0 1 1 2 2 ELSE 100);
-SET &INCLUDE_FEX_NAME = '-INCLUDE test_semi_dynamic' || &INCLUDE_FEX_NO || '.fex';
-TYPE &INCLUDE_FEX_NAME|.EVAL
&INCLUDE_FEX_NAME.EVAL


Please note: the a.m. code works for all &INCLUDE_SELECTOR but &INCLUDE_SELECTOR == 2 (to really show that you have to fake include all fexes correctly).

Also note: the include statement does not contain the app/ path. That did not work for me.

Hope this helps and also still works on WF8

Cheers Linne


WebFOCUS 7.7.03
 
Posts: 67 | Registered: January 05, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] unable to dynamically include a file from an amper in MR

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