Focal Point
Conditional Include Not Working [SOLVED]

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

June 12, 2013, 09:56 AM
Maverick01
Conditional Include Not Working [SOLVED]
I am trying to do a conditional include based on the input of a dropdown box. I used some code I found in the forum, but it is not working.

This code is in the parent fex:
-SET &REPORTTYPE = &RTYPE.(,,).REPORTTYPE.;
-SET &DATASET = IF '&REPORTTYPE' EQ 'PRICING' THEN 'MLAPMETRICSORT1.FEX' ELSE 'MLAPMETRICSORT.FEX';


Then in a fex that I am including I make the reference:
-MRNOEDIT -INCLUDE &DATASET

I do not get an error, just no data shows up. If I hard code one fex or the other like:
-INCLUDE MLAPMETRICSORT1.FEX

it works.

Any help would be appreciated.

This message has been edited. Last edited by: Maverick01,


7702,
Windows 7, Excel (2007),
June 12, 2013, 10:20 AM
Francis Mariani
Try -INCLUDE &DATASET.EVAL but even that may not work - embedding amper variables in an INCLUDE statement isn't kosher.

I would do it this way:
-IF &REPORTTYPE EQ 'PRICING' GOTO SORT1 ELSE GOTO SORT;

-SORT1
-MRNOEDIT -INCLUDE mlapmetricsort1.fex

-GOTO SORTEND

-SORT
-MRNOEDIT -INCLUDE mlapmetricsort.fex

-SORTEND



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
June 12, 2013, 10:48 AM
J
Try using the app folder name and then the fex since that is how the GUI does it:

 
-SET &DATASET = 'yourappfolder/mlapmetricsort1.fex';
-MRNOEDIT -INCLUDE &DATASET
 


I know it works for htmlform at least

EDIT: It does work for fexes as well.

BTW when doing an htmlform with the MRNOEDIT, I do not run into the 8 character limit for file names using htmlform. Hmm...

This message has been edited. Last edited by: J,


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 11:06 AM
Maverick01
I am going to try Francis' solution.
J, I have tried the app folder and same issue.
Thanks for the replies.


7702,
Windows 7, Excel (2007),
June 12, 2013, 11:19 AM
J
Sorry to hear that... maybe a 7702 thing.


Have you tried through the GUI to get the correct syntax for an INCLUDE outside of the MRE? Maybe its a little different in your version? Confused


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 11:22 AM
Maverick01
I haven't tried that yet, but Francis solution is going to work fine for what I am doing. Thanks for the replies.


7702,
Windows 7, Excel (2007),
June 12, 2013, 11:25 AM
J
Hold on a sec. If I just hardcode -INCLUDE myfile.fex, it does not work because the file is in the apps folder

If plain old -include yourfex.fex is working, the fex must be in the MRE.

Try:
 
-SET &DATASET = 'app/mlapmetricsort1.fex';
-INCLUDE &DATASET
 


It is good practice to avoid GOTO's as much as possible.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 11:27 AM
Maverick01
quote:
-SET &DATASET = 'app/mlapmetricsort1.fex';
-INCLUDE &DATASET



That is one that I have tried. Get this error:

ERROR: ERROR_MR_FEX_NOT_FOUND Can't create item object based on provided item key &DATASET.fex.


7702,
Windows 7, Excel (2007),
June 12, 2013, 11:35 AM
J
Looks like you are right. The original solution I wrote works if the fex is in dataservers and the HTML is in the MRE but not if both of them are in the MRE. This seems vaguely familiar.

The same goes with the htmlform 8 character limit. The limit only applies if the html page is in the MRE.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 11:36 AM
j.gross
Of course not. An MRE-type -INCLUDE is resolved in the client, where & is just another character. &var substitution only happens on the back-end (webfocus reporting) server.


- Jack Gross
WF through 8.1.05
June 12, 2013, 11:48 AM
Francis Mariani
quote:
An MRE-type -INCLUDE is resolved in the client, where & is just another character. &var substitution only happens on the back-end (webfocus reporting) server.


So, what does that mean?


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
June 12, 2013, 11:55 AM
J
So we won't have this issue in v.8 then?


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 11:57 AM
Francis Mariani
Confused


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
June 12, 2013, 12:02 PM
J
Francis:

clarification


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 12:08 PM
Francis Mariani
J, thanks for the link to the MRNOEDIT explanation.

Now, how does it apply to code like this:

-MRNOEDIT -INCLUDE &DATASET


Because of -MRNOEDIT, MRE will not evaluate the Dialogue manager variable, but will the reporting server evaluate -INCLUDE &DATASET?


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
June 12, 2013, 12:13 PM
J
If you tie what j.gross says and what the wordy link I sent you says, it makes sense. Mavericks solution won't work because the include is handled client side.

Because of that, he tried to use the MRNOEDIT feature to handle it on the back end. However, the file he was referencing is located in the MRE, so the reporting server knows nothing about it. If it was located in the data servers section, there wouldn't be an issue.

I think this whole thing goes away in 8 since everything is in one repository. Or have the little birds been lying to me all along.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 12:24 PM
Francis Mariani
In WebFOCUS 8, you can still have fexes residing in app folders on the reporting server...


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
June 12, 2013, 12:30 PM
J
They did lie to me. It is the authentication that is centralized...

I also heard something about getting rid of domains and security is based on tabs for the portal?


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
June 12, 2013, 04:43 PM
j.gross
quote:
Originally posted by Francis Mariani:
...I would do it this way:
-IF &REPORTTYPE EQ 'PRICING' GOTO SORT1 ELSE GOTO SORT;

-SORT1

-MRNOEDIT -INCLUDE mlapmetricsort1.fex

-GOTO SORTEND

-SORT
-MRNOEDIT -INCLUDE mlapmetricsort.fex

-SORTEND


So would I, if they're stored in MR repos.

Just bear in mind, both of the MR includes will be expanded and sent up to the server (and down again, to the browser, for a round trip, if autoprompting kicks in). If they contain any labels (for GOTO or REPEAT), make sure they are unique across the two (or however many) included MR fex files + the main fex.
June 10, 2014, 10:00 AM
j.gross
An alternate solution:

Move the dynamics of which report to invoke out of MR, into the province of the back-end Reporting Server.

* create a little driver fex on the reporting server (not in MR repository), in the same APP folder as the two report fex files;

* hard-code its name and location in the -MRNOEDIT -INCLUDE

* have the driver fex invoke the appropriate report fex (based on the &REPORTTYPE parameter). Note that the -INCLUDE in the driver should not have -MRNOEDIT, since it is stored on the reporting server.