Focal Point
[SOLVED] Conditional include

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

September 04, 2008, 07:19 AM
Majid Jeddi
[SOLVED] Conditional include
Hi,

When using -INCLUDE APPDIR/FEXFILENAME Everything works fine in my report
But when i define a variable like
-SET &VARNAME = IF condition THEN 'fexfilename'
ELSE 'ANOTHERFEXFILENAME' END
-INCLUDE &VARNAME
i am not able to schedule my report with report caster getting a message:
WEBFOCUS REPIORTING SERVER PROCEDURE CANNOT BE FOUND.

I am using webfocus 7.6.4.

Regards.

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


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
September 04, 2008, 07:41 AM
GamP
quote:
-SET &VARNAME = IF condition THEN 'fexfilename' ELSE 'ANOTHERFEXFILENAME' END
-INCLUDE &VARNAME


The above should read something like:
-SET &VARNAME = IF condition THEN 'fexfilename' ELSE 'ANOTHERFEXFILENAME';
-INCLUDE APPDIR/&VARNAME.EVAL

Maybe by doing it like this it will work.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 04, 2008, 09:18 AM
Majid Jeddi
quote:
-INCLUDE APPDIR/&VARNAME.EVAL

Hi,

Thanks for your reply. It still not working and getting the same error.

Regards.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
September 04, 2008, 09:27 AM
nubi
 
-SET &VARNAME = IF condition THEN 'fexfilename' 
ELSE 'ANOTHERFEXFILENAME' END
-INCLUDE &VARNAME 


instead of the above try this:

-SET &VARNAME = IF condition THEN 'fexfilename' 
-ELSE 'ANOTHERFEXFILENAME' END
-INCLUDE &VARNAME


if you are using DM you need to start every line with a - symbol (i learned this literally minutes ago.)


Developer Studio 7.64
Win XP
Output: mostly HTML, also Excel and PDF

"Never attribute to malice that which can be adequately explained by stupidity." - Heinlein's Razor
September 04, 2008, 09:37 AM
Glenda
Try this.

 
-* S = SUMMARY (CAR2)
-* D = DETAIL  (CAR1)
-SET &PULL     = S;
-* YOUR FIRST FEX
-SET &CAR1     = '/eda53/ibi/apps/dashboard/car1.fex';
-* YOUR SECOND FEX
-SET &CAR2     = '/eda53/ibi/apps/dashboard/car2.fex';
-SET &RUNFEX   = DECODE &PULL(S '&CAR2.EVAL' D '&CAR1.EVAL');
-SET &&INCLUDE = '-INCLUDE';
-TYPE &CAR1

&&INCLUDE.EVAL &RUNFEX.EVAL


Substitute the path of your fexes for &CAR1 and &CAR2.


Glenda

In FOCUS Since 1990
Production 8.2 Windows
September 04, 2008, 09:37 AM
Tom Flynn
quote:
-SET &VARNAME = IF condition THEN 'fexfilename'
-ELSE 'ANOTHERFEXFILENAME' END
-INCLUDE &VARNAME


A Dialogue Manager statement ends with a semi-colon, not END.

You need MRNOEDIT:

  
-SET &CNTR = 2;
-SET &VARNAME = IF &CNTR EQ 1 THEN 'foldername/focexec.fex' 
-                             ELSE 'foldername/focexec.fex';
-MRNOEDIT -INCLUDE &VARNAME



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 04, 2008, 11:43 AM
Glenda
Does the following code really work?


[CODE]
-SET &VARNAME = IF &CNTR EQ 1 THEN 'foldername/focexec.fex'
- ELSE 'foldername/focexec.fex';
[CODE]

Is the "-" used to continue the previous line?


Glenda

In FOCUS Since 1990
Production 8.2 Windows
September 04, 2008, 11:44 AM
Glenda
Posted September 04, 2008 11:43 AM Hide Post
Sorry!


-SET &VARNAME = IF &CNTR EQ 1 THEN 'foldername/focexec.fex' 
- ELSE 'foldername/focexec.fex';



Glenda

In FOCUS Since 1990
Production 8.2 Windows
September 04, 2008, 11:45 AM
Tom Flynn
Hi Glenda,

Yes, it is to continue the previous line, AND, it really works...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 04, 2008, 02:10 PM
Glenda
I can't seem to make it work. Is there some secret to this?

This code
-SET &INP1 = 1;
-SET &DIR  = IF &INPUT EQ 1 THEN '/rimsi/site1/prod2' ELSE
-            IF &INPUT EQ 2 '/anicoi/site1/prod4' ELSE
-            IF &INPUT EQ 3 '/rimsi/site1/train2' ELSE
-            IF &INPUT EQ 4 '/anicodi/site1/prod2' ELSE
-            IF &INPUT EQ 5 '/anicoui/site1/prod3' ELSE
-            IF &INPUT EQ 6 '/anicoui/site1/prod4' ELSE
-            IF &INPUT EQ 7 '/rims/site1/prod1' ELSE
-            IF &INPUT EQ 8 '/modl/site1/prod1' ELSE
-            IF &INPUT EQ 9 '/rims/site1/train2' ELSE
-            IF &INPUT EQ 10 '/anicodi/site1/prod1' ELSE
-            IF &INPUT EQ 11 '/anicoui/site1/prod1' ELSE
-            IF &INPUT EQ 12 '/anicoui/site1/prod1' ELSE
-            IF &INPUT EQ 13 '/rimsm/site1/prodm' ELSE
-            IF &INPUT EQ 14 '/anicom/site1/prodm' ELSE
-            IF &INPUT EQ 15 '/rimsm/site1/prodm' ELSE
-            IF &INPUT EQ 16 '/anicodm/site1/prodm' ELSE
-            IF &INPUT EQ 17 '/anicoum/site1/prodm' ELSE '/anicoum/site1/prod4';
-SET &FDEF1        = 'FILEDEF ADJMST DISK &DIR.EVAL/adjmst';
-*SET &FDEF2       = 'FILEDEF CONTRL DISK &DIR.EVAL/contrl';
-*SET &FDEF3       = 'FILEDEF SIGNRS DISK &DIR.EVAL/signrs';
-*SET &FDEF4       = 'FILEDEF SIGNGP DISK &DIR.EVAL/signgp';
-TYPE DIR   => &DIR
-TYPE FDEF1 => &FDEF1
-EXIT


Results in this error:

(FOC261) EXPRESSION IS INCOMPLETE BECAUSE AN OPERATION IS MISSING

AND

This code:

-SET &INP1 = 1;
-SET &DIR        = DECODE &INPUT(1 '/rimsi/site1/prod2'
-                                2 '/anicoi/site1/prod4'
-                                3 '/rimsi/site1/train2'
-                                4 '/anicodi/site1/prod2'
-                                5 '/anicoui/site1/prod3'
-                                6 '/anicoui/site1/prod4'
-                                7 '/rims/site1/prod1'
-                                8 '/modl/site1/prod1'
-                                9 '/rims/site1/train2'
-                                10 '/anicodi/site1/prod1'
-                                11 '/anicoui/site1/prod1'
-                                12 '/anicoui/site1/prod1'
-                                13 '/rimsm/site1/prodm'
-                                14 '/anicom/site1/prodm'
-                                15 '/rimsm/site1/prodm'
-                                16 '/anicodm/site1/prodm'
-                                17 '/anicoum/site1/prodm'
-                                18 '/anicoum/site1/prod4');
-SET &FDEF1        = 'FILEDEF ADJMST DISK &DIR.EVAL/adjmst';
-*SET &FDEF2       = 'FILEDEF CONTRL DISK &DIR.EVAL/contrl';
-*SET &FDEF3       = 'FILEDEF SIGNRS DISK &DIR.EVAL/signrs';
-*SET &FDEF4       = 'FILEDEF SIGNGP DISK &DIR.EVAL/signgp';
-TYPE DIR   => &DIR
-TYPE FDEF1 => &FDEF1
-EXIT


Has these results:

DIR =>
FDEF1 => FILEDEF ADJMST DISK /adjmst


?????


Glenda

In FOCUS Since 1990
Production 8.2 Windows
September 04, 2008, 02:15 PM
Tom Flynn
Hi Glenda,

Syntax error:

Shouldn't &INPUT be &INP1??

quote:

-SET &INP1 = 1;
-SET &DIR = IF &INPUT EQ 1 '/rimsi/site1/prod2' ELSE
- IF &INPUT EQ 2 '/anicoi/site1/prod4' ELSE
- IF &INPUT EQ 3 '/rimsi/site1/train2' ELSE
- IF &INPUT EQ 4 '/anicodi/site1/prod2' ELSE
- IF &INPUT EQ 5 '/anicoui/site1/prod3' ELSE
- IF &INPUT EQ 6 '/anicoui/site1/prod4' ELSE
- IF &INPUT EQ 7 '/rims/site1/prod1' ELSE
- IF &INPUT EQ 8 '/modl/site1/prod1' ELSE
- IF &INPUT EQ 9 '/rims/site1/train2' ELSE
- IF &INPUT EQ 10 '/anicodi/site1/prod1' ELSE
- IF &INPUT EQ 11 '/anicoui/site1/prod1' ELSE
- IF &INPUT EQ 12 '/anicoui/site1/prod1' ELSE
- IF &INPUT EQ 13 '/rimsm/site1/prodm' ELSE
- IF &INPUT EQ 14 '/anicom/site1/prodm' ELSE
- IF &INPUT EQ 15 '/rimsm/site1/prodm' ELSE
- IF &INPUT EQ 16 '/anicodm/site1/prodm' ELSE
- IF &INPUT EQ 17 '/anicoum/site1/prodm' ELSE '/anicoum/site1/prod4';


IF-THEN-ELSE, missing THEN

IF &INPUT EQ 1 THEN '/rimsi/site1/prod2' ELSE

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 04, 2008, 02:22 PM
Tom Flynn
quote:
-SET &INP1 = 1;
-SET &DIR = DECODE &INPUT(1 '/rimsi/site1/prod2'
- 2 '/anicoi/site1/prod4'
- 3 '/rimsi/site1/train2'
- 4 '/anicodi/site1/prod2'
- 5 '/anicoui/site1/prod3'
- 6 '/anicoui/site1/prod4'
- 7 '/rims/site1/prod1'
- 8 '/modl/site1/prod1'
- 9 '/rims/site1/train2'
- 10 '/anicodi/site1/prod1'
- 11 '/anicoui/site1/prod1'
- 12 '/anicoui/site1/prod1'
- 13 '/rimsm/site1/prodm'
- 14 '/anicom/site1/prodm'
- 15 '/rimsm/site1/prodm'
- 16 '/anicodm/site1/prodm'
- 17 '/anicoum/site1/prodm'
- 18 '/anicoum/site1/prod4');
-SET &FDEF1 = 'FILEDEF ADJMST DISK &DIR.EVAL/adjmst';
-*SET &FDEF2 = 'FILEDEF CONTRL DISK &DIR.EVAL/contrl';
-*SET &FDEF3 = 'FILEDEF SIGNRS DISK &DIR.EVAL/signrs';
-*SET &FDEF4 = 'FILEDEF SIGNGP DISK &DIR.EVAL/signgp';
-TYPE DIR => &DIR
-TYPE FDEF1 => &FDEF1
-EXIT


My Output, replacing &INPUT with &INP1:

-SET &INP1 = 1;
-SET &DIR = DECODE 1 (1 '/rimsi/site1/prod2'
- 2 '/anicoi/site1/prod4'
- 3 '/rimsi/site1/train2'
- 4 '/anicodi/site1/prod2'
- 5 '/anicoui/site1/prod3'
- 6 '/anicoui/site1/prod4'
- 7 '/rims/site1/prod1'
- 8 '/modl/site1/prod1'
- 9 '/rims/site1/train2'
- 10 '/anicodi/site1/prod1'
- 11 '/anicoui/site1/prod1'
- 12 '/anicoui/site1/prod1'
- 13 '/rimsm/site1/prodm'
- 14 '/anicom/site1/prodm'
- 15 '/rimsm/site1/prodm'
- 16 '/anicodm/site1/prodm'
- 17 '/anicoum/site1/prodm'
- 18 '/anicoum/site1/prod4');
-SET &FDEF1 = 'FILEDEF ADJMST DISK /rimsi/site1/prod2/adjmst';
-*SET &FDEF2 = 'FILEDEF CONTRL DISK &DIR.EVAL/contrl';
-*SET &FDEF3 = 'FILEDEF SIGNRS DISK &DIR.EVAL/signrs';
-*SET &FDEF4 = 'FILEDEF SIGNGP DISK &DIR.EVAL/signgp';
-TYPE DIR => /rimsi/site1/prod2
DIR => /rimsi/site1/prod2
-TYPE FDEF1 => FILEDEF ADJMST DISK /rimsi/site1/prod2/adjmst
FDEF1 => FILEDEF ADJMST DISK /rimsi/site1/prod2/adjmst
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 04, 2008, 02:26 PM
Glenda
Oh just shoot me and put me out of my misery.

What a beginners error that one was. Sorry to take up valuable time on something so trivial.

Thanks


Glenda

In FOCUS Since 1990
Production 8.2 Windows
September 04, 2008, 02:28 PM
Tom Flynn
Too Funny!!!

We ALL!!! have a brain freeze every once in awhile!!!

Winky

For your penance, you must take over Prairie's job of pointing out, to new members, how to update their profiles, for 1 week!!!

Tom

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
September 04, 2008, 02:43 PM
Prarie
Smiler
September 04, 2008, 02:47 PM
j.gross
When you've recovered sufficiently, add a final ELSE to the DECODE, perhaps

ELSE '/(no path)/');

I know, it can *never* happen ... but at least when it does you will have some gingerbread crumbs to follow.


- Jack Gross
WF through 8.1.05
September 04, 2008, 03:09 PM
Glenda
Just for you I'll add it. However, the user must click a radio button and I hard code their options.

You and my partner think alike. He likes the default also.


Glenda

In FOCUS Since 1990
Production 8.2 Windows
September 04, 2008, 04:00 PM
RSquared
quote:
p

Glenda,

After being bitten in the nether regions once to often by not coding for the default, you tend to suggest it at all times. I know, I have been there.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
September 04, 2008, 04:46 PM
Glenda
Any time you have user input, it is bound to happen.

That is the reason we went to Radio button input with a default set.

I don't even let the users input the date (they must pick from the calendar)!

But as you say, it is best to have coding standards in place that will prevent the unspeakable from happening.

Thanks,


Glenda

In FOCUS Since 1990
Production 8.2 Windows
September 05, 2008, 07:59 AM
Majid Jeddi
H Everybody,

Yes it is fixed with the proposal of Glenda.

Thanks a lot.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
September 05, 2008, 11:23 AM
Prarie
Majid,

Please edit the Title of your post as requested Here

Thanks


In Focus since 1993. WebFOCUS 7.7.03 Win 2003