Sarah Kalavoda Posted September 7, 2021 Share Posted September 7, 2021 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 More sharing options...
David Beagan Posted September 7, 2021 Share Posted September 7, 2021 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 More sharing options...
Sarah Kalavoda Posted September 8, 2021 Author Share Posted September 8, 2021 Hi, Thank you so much for the reply! I made the change, but when filter value Report 2 or Report 3 is selected, it still calls the first include (report_1). It seems to be ignoring my GOTO command. Is this a bug Thanks again, Sarah Link to comment Share on other sites More sharing options...
Martin Yergeau Posted September 8, 2021 Share Posted September 8, 2021 You may not receive the value that you are expecting in &FILTER Add the following before your IF test -TYPE FILTER received value: -->&FILTER<-- -EXIT Link to comment Share on other sites More sharing options...
Douglas Lee 2 Posted September 8, 2021 Share Posted September 8, 2021 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 More sharing options...
Toby Mills Posted September 8, 2021 Share Posted September 8, 2021 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 More sharing options...
Dirk Kuerbig Posted September 8, 2021 Share Posted September 8, 2021 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 More sharing options...
David Beagan Posted September 8, 2021 Share Posted September 8, 2021 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 More sharing options...
Manoj Chaurasia Posted September 8, 2021 Share Posted September 8, 2021 I think but not entirely positive if you use the code tag before and after the code image.png80077 6.32 KB it will not substitute the curly quotes Link to comment Share on other sites More sharing options...
Dirk Kuerbig Posted September 9, 2021 Share Posted September 9, 2021 Hello David, exactly my point Your answer was correct, however Sarah could not test it copying it in because these curly quotes were created. Link to comment Share on other sites More sharing options...
Dirk Kuerbig Posted September 9, 2021 Share Posted September 9, 2021 You can give it a try and confirm, by doing the following Copy the code that you originally posted from this web page Paste it into a WebFOCUS text editor Run it You should see (at least I did) the error messages Manually fix the quotes It works Link to comment Share on other sites More sharing options...
Toby Mills Posted September 9, 2021 Share Posted September 9, 2021 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 More sharing options...
David Beagan Posted September 9, 2021 Share Posted September 9, 2021 Ah, I see what you mean. Thanks. Link to comment Share on other sites More sharing options...
David Beagan Posted September 9, 2021 Share Posted September 9, 2021 I definitely would be in favor of ditching the curly quotes. Link to comment Share on other sites More sharing options...
David Briars Posted September 9, 2021 Share Posted September 9, 2021 Not sure what Moe and Larry would think about this. Link to comment Share on other sites More sharing options...
David Beagan Posted September 9, 2021 Share Posted September 9, 2021 Shemp. Link to comment Share on other sites More sharing options...
Sarah Kalavoda Posted September 9, 2021 Author Share Posted September 9, 2021 I appreciate all the helpful posts here! The issue has been resolved. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now