[SHARING] unable to dynamically include a file from an amper in MR
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/';
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.
JodyeThis message has been edited. Last edited by: <Kathryn Henning>,
WF 8.0.0.5M
October 11, 2013, 01:24 AM
njsden
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.
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
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
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
October 14, 2013, 03:07 AM
Dave
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 ).
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
October 14, 2013, 09:06 AM
Tom Flynn
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...
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
October 15, 2013, 09:19 AM
jodye
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.
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
October 30, 2013, 07:45 PM
dbeagan
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.
WebFOCUS 8.2.06
October 30, 2013, 10:23 PM
Francis Mariani
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
October 30, 2013, 10:38 PM
David Beagan
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.
October 31, 2013, 10:29 AM
Francis Mariani
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
November 01, 2013, 04:31 AM
linnex
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.