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] how assign a value from TABLE FILE to a variable

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] how assign a value from TABLE FILE to a variable
 Login/Join
 
Member
posted
How can I get value returns from TABLE FILE assign to a variable then do comparation.

TABLE FILE CARS
PRINT CAR
WHERE CAR EQ 'BMW'
END


-IF VARIABLE EQ 'BMW' THEN GOTO LBL_BMW ELSE GOTO LBL_EXIT;

-LBL_BMW

-LBL_EXIT

This message has been edited. Last edited by: <Kathryn Henning>,


Webfocus 7.7.02, Win 7,Pdf, Excel, HTML
 
Posts: 25 | Location: VA | Registered: September 10, 2011Report This Post
Expert
posted Hide Post
Use -READFILE:

TABLE FILE CAR
PRINT CAR
WHERE CAR EQ 'BMW'
ON TABLE HOLD AS HCAR FORMAT ALPHA
END
-RUN

-READFILE HCAR

-IF &CAR EQ 'BMW' GOTO LBL_BMW ELSE GOTO LBL_EXIT;

-LBL_BMW
-TYPE YIPPIE, I HAVE A &CAR
-GOTO LBL_FINITO

-LBL_EXIT
-TYPE SHUCKS, I HAVE A &CAR

-LBL_FINITO


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Small update - test for no result:

TABLE FILE CAR
PRINT CAR
WHERE CAR EQ 'BMW'
ON TABLE HOLD AS HCAR FORMAT ALPHA
END
-RUN

-READFILE HCAR

-IF &CAR.EXISTS EQ 0 GOTO LBL_NOCAR;
-IF &CAR EQ 'BMW' GOTO LBL_BMW ELSE GOTO LBL_EXIT;

-LBL_BMW
-TYPE YIPPIE, I HAVE A &CAR
-GOTO LBL_FINITO

-LBL_EXIT
-TYPE SHUCKS, I HAVE A &CAR
-GOTO LBL_FINITO

-LBL_NOCAR
-TYPE AWWW, I HAVE NO CAR
-GOTO LBL_FINITO

-LBL_FINITO


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
I often find it simpler to move the test to the TABLE request and just check with &LINES whether we had any results or not.
TABLE FILE CAR
SUM FST.CAR
WHERE CAR EQ 'BMW';
END
-RUN
-IF &LINES GT 0 THEN GOTO LBL_BMW ELSE GOTO LBL_EXIT;


BTW, you don't need a LBL_EXIT, you can use EXIT as a label and the code will re-evaluate that label and find that it's also an -EXIT command.

That implies that you can't use EXIT conditionally unless you put the "label" somewhere in your code. It also implies that you shouldn't call -EXIT more than once in your procedure, since labels are supposed to be unique - fortunately, that requirement is not true for -EXIT.

I'm pretty certain that any computer science student putting that in their language design course test would fail their test, but in a commercial product apparently anything goes. If I understand correctly, it's considered "cool" to unnecessarily re-evaluate lines of code. I find that slightly humorous.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Expert
posted Hide Post
Your "Small update - test for no result:" just goes to show that "An old coder never leaves a mess" Smiler
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Member
posted Hide Post
Thank you all. it worked.


Webfocus 7.7.02, Win 7,Pdf, Excel, HTML
 
Posts: 25 | Location: VA | Registered: September 10, 2011Report 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] how assign a value from TABLE FILE to a variable

Copyright © 1996-2020 Information Builders