Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [solved]simple question on replacing GOTO name

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[solved]simple question on replacing GOTO name
 Login/Join
 
Platinum Member
posted
I am trying to give some dynamic name for my GOTO statement but unfortunately it is not working. I might be doing something wrong OR that is not possible. How can I achieve that?

sample code:

-SET &CNT=1;

-SET &TESTVAR='TEST';

-IF &CNT EQ 1 THEN GOTO &TESTVAR.EVALLOOP1
-ELSE GOTO &TESTVAR.EVALLOOP2;

-&TESTVAR.EVALLOOP1
-TYPE LOOP1 VALUE
-&TESTVAR.EVALLOOP2
-EXIT

when I run the above code, it throws the error says "TESTLOOP1 is missing".

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


8.2.06
Windows, All Formats
 
Posts: 184 | Registered: December 27, 2013Report This Post
Virtuoso
posted Hide Post
It is easier than you might think...
-SET &CNT=2;

-SET &TESTVAR='TEST';

-GOTO &TESTVAR&CNT

-TEST1
-TYPE LOOP1 VALUE
-EXIT
-TEST2
-TYPE THIS IS LOOP 2
-EXIT


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Platinum Member
posted Hide Post
I cannot do that because I will be using the same code on bottom of my report. If I do like this then my report is getting in to infinite loop.


8.2.06
Windows, All Formats
 
Posts: 184 | Registered: December 27, 2013Report This Post
Virtuoso
posted Hide Post
A tag (step name) cannot be dynamic it must exist before evaluation, the GOTO can be dynamic as shown by GamP.
Each tag must be unique and you need a condition that will get you out of the loop.

It looks like we're missing some information to answer you properly.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Virtuoso
posted Hide Post
You need to understand the rules:

  • The GOTO reference to a label can be dynamic (use a &var and .EVAL)

  • The line declaring the referenced label must appear in the same fex file as the GOTO, and must be static (i.e., no &'s).

  • All labels appearing in a single fex file must be unique.

  • A GOTO statement can only reference labels declared in the same fex file.

SO:
If you can wrap one or both of the sections containing a GOTO and the labels it references in a separate fex file, -INCLUDEd in the main fex, there will be no conflict. That will allow you to use the same "stub" for all the labels, and simplify the form of the GOTO to "GOTO STUB&CNT.EVAL".

If you are inserting the same logic into a succession of TABLE requests, you can skirt the issue by wrapping each TABLE request in a separate fex invoked via -INCLUDE.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
Thanks all for the valuable inputs. It helps me understand the rules of GOTO (Thanks J.gross).

I ended up using the & variable after the static value as J.gross mentioned.


8.2.06
Windows, All Formats
 
Posts: 184 | Registered: December 27, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [solved]simple question on replacing GOTO name

Copyright © 1996-2020 Information Builders