Jump to content
The ibi Community has moved to a new platform: Please Sign In and choose Forgot Password to continue

Im trying to call different fexes based on a filter selecti...


Sarah Kalavoda

Recommended Posts

Im trying to call different fexes based on a filter selection. I have a procedure that Ive written to do this, that Ive loaded onto a designer page. However, the GOTO doesnt seem to working properly, as it is not skipping the first include if the second value is selected. The output shows one page, with all three procedures displaying. Is there a better way to write this Thanks in advance!

-IF &FILTER EQ Report 1 THEN GOTO :REPORT_1

ELSE IF &FILTER EQ Report 2 THEN GOTO :REPORT_2

ELSE IF &FILTER EQ Report 3 THEN GOTO :REPORT_3

ELSE :REPORT_EXIT;

-:REPORT_1

-INCLUDE IBFS:/WFC/Repository/FEX1.fex

-EXIT

-:REPORT_2

-INCLUDE IBFS:/WFC/Repository/FEX2.fex

-EXIT

-:REPORT_3

-INCLUDE IBFS:/WFC/Repository/FEX3.fex

-EXIT

-:REPORT_EXIT

-EXIT

Sarah Kalavoda

WF Developer

Version 8206

Link to comment
Share on other sites

Change this:

-IF &FILTER EQ Report 1 THEN GOTO :REPORT_1

ELSE IF &FILTER EQ Report 2 THEN GOTO :REPORT_2

ELSE IF &FILTER EQ Report 3 THEN GOTO :REPORT_3

ELSE :REPORT_EXIT;

 

To this:

-IF &FILTER EQ Report 1 THEN GOTO :REPORT_1

-ELSE IF &FILTER EQ Report 2 THEN GOTO :REPORT_2

-ELSE IF &FILTER EQ Report 3 THEN GOTO :REPORT_3

-ELSE :REPORT_EXIT;

Link to comment
Share on other sites

Consider This, based on the filter being 1, 2, 3, or Exit:

-GOTO :REPORT_&FILTER.EVAL;

-:REPORT_1

-INCLUDE IBFS:/WFC/Repository/FEX1.fex

-GOTO :REPORT_EXIT

-:REPORT_2

-INCLUDE IBFS:/WFC/Repository/FEX2.fex

-GOTO :REPORT_EXIT

-:REPORT_3

-INCLUDE IBFS:/WFC/Repository/FEX3.fex

-GOTO :REPORT_EXIT

-:REPORT_EXIT

-EXIT

The use of -GOTO :REPORT_EXIT is based on not using -EXIT mid-fex. Its not even needed at the end of a fex.

Link to comment
Share on other sites

Hi Sarah

Dont forget to start each line with the - and make sure you change your last ELSE to be a GOTO :REPORT_EXIT.

Or do like Doug suggested and just -GOTO the appropriate label without if/then/else

If you run this with

-SET &ECHO=ALL; you should be able to see what WebFOCUS is thinking.

Good luck!

Link to comment
Share on other sites

You are all correct in your suggestions, however you are missing a significant part.

The quote symbols do not actually seem to be single quotes, they just LOOK like they are.

Error messages show up when simply copying the code as is into a procedure.

You will likely see something like this when running the procedure

 

image.png798180 5.21 KB

 

Clicking on the blue error text

will show

 

image.png800245 9.43 KB

 

SOLUTION

Adding the GOTO statement as suggested at the last ELSE part, and replacing the special characters around the text (e.g. Report 1) with single quotes solves the issue for me.

Here is working sample code

-DEFAULT &FILTER=Report 1;

-IF &FILTER EQ Report 1 THEN GOTO :REPORT_1

-ELSE IF &FILTER EQ Report 2 THEN GOTO :REPORT_2

-ELSE IF &FILTER EQ Report 3 THEN GOTO :REPORT_3

-ELSE GOTO :REPORT_EXIT;

-:REPORT_1

-TYPE -INCLUDE IBFS:/WFC/Repository/FEX1.fex

-EXIT

-:REPORT_2

-TYPE -INCLUDE IBFS:/WFC/Repository/FEX2.fex

-EXIT

-:REPORT_3

-TYPE -INCLUDE IBFS:/WFC/Repository/FEX3.fex

-EXIT

-:REPORT_EXIT

-TYPE EXIT

-EXIT

When running the procedure, you should see something like this

 

image.png791210 6.82 KB

 

Please note, copying the text above through the response here may not copy the quote properly.

If you still run into a problem, please manually replace the starting and ending quote symbol around the text.

Good luck

Link to comment
Share on other sites

Im thinking the quotes are probably not the problem. Lots of code gets posted that has these curly quotes when the original code is ok. For example, if I just paste in correct code:

-SET &VAR = abc;

It gets the curly quotes, which wont work if pasted back into a WF editor.

In my answer I simply copied the posted code and it replicated the curly quotes in my post.

Link to comment
Share on other sites

Lets test The idea of using the tag code.

Heres a sample:

-SET &X=THIS IS A TEST;

Then we use the code tag:

-SET &X='THIS IS A TEST';

 

Looks like that works. For the purpose of most of us here, the use of curly quotes (also called smart quotes) isnt helpful. Might be pretty, but not helpful.

I tried looking for an admin manual for Influitive to see if thats just a setting we can turn off for myibi, but I didnt find anything. I did find such a setting for MS Word and some notes about wordpress.

Id totally be in favor of ditching the curly quotes in myibi globally if thats possible.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...