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     [CLOSED] How does EVAL function

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] How does EVAL function
 Login/Join
 
Gold member
posted
All,

Could anyone explain me the process flow of this code.


-SET &TABLE=SUM&CAR.EVAL;
-IF &CAR NE TOYOTA THEN GOTO LABEL;
-SET &TABLE=TOTAL&CAR.EVAL;
TABLE FILE SUM&CAR.EVAL
SUM SALES
BY &CAR
ON TABLE HOLD AS &TABLE
END

JOIN &CAR IN &TABLE TO ALL &CAR IN SUM&CAR END
-LABEL

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


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
 
Posts: 79 | Location: New York | Registered: February 04, 2010Report This Post
Expert
posted Hide Post
This seems to be only part of the complete code... So I can only give part of the answer. Apparently, &CAR has beet -SET prior to what we see here (We'll use 'FORD'). Seein g that 'FORD" is not 'TOYOTA" (and why should it be?) Then the fex branches to "LABEL" (which is a bad name, imho, for a "LABEL". But, if &CAR was 'TOYOTA' then it would fall thru and do the "-SET &TABLE=TOTAL&CAR.EVAL;" which eqautes to &TABLE being -SET to 'TOTALTOYOTA'. The .EVAL evaluates the variable before the line is interpreted... ending up with
TABLE FILE SUMTOYOTA
SUM SALES
BY &CAR
ON TABLE HOLD AS TOYOTA
END
JOIN TOYOTA IN TOTALTOYOTA TO ALL TOYOTA IN SUMTOYOTA AS JOIN1
-* I added the JOIN1
-* No need for this extraneous "END"
-LABEL
-*-*-* continues on with processing...
.. or, at least that's what I think...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
Syntactically correct code would be for instance:
-SET &TABLEsum='SUM&CAR.EVAL';
-IF &CAR NE 'TOYOTA' THEN GOTO :LABEL;
-SET &TABLEtot='TOTAL&CAR.EVAL';
TABLE FILE &TABLEsum
SUM SALES
BY &CAR
ON TABLE HOLD AS &TABLEtot
END

JOIN &CAR IN &TABLEtot TO ALL &CAR IN &TABLEsum AS J1
-:LABEL

It is a wise thing to keep strings strings. So enclose them in single quotes.
To prevent DM to place the &CAR in the string as is, expand it with .EVAL. Otherwise the variable &TABLEsum would have the value 'SUM&CAR', with .EVAL it will be set to 'SUMFORD' (to go with Doug's example). And I agree with Doug, naming a label LABEL is not such a good idea. I make it a rule for myself to start a label (any label) with a colon ( : ). But that's my own private naming convention...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
From memory, its been a while, this is all explained in the FOCUS training courses.

The interesting thing here is why use EVAL in a -SET.

You can use -SET &TABLE='SUM'|&CAR;

The same is achieved with
-IF &CAR NE TOYOTA THEN GOTO LABEL;
TABLE FILE SUM&CAR
SUM SALES
BY &CAR
ON TABLE HOLD AS TABLE&CAR
END

JOIN &CAR IN TABLE&CAR TO ALL &CAR IN SUM&CAR END
-LABEL


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Well put guys... This seems to be some incomplete code (which was presented) So, I just went with that... You both pointed out some "cleaner" (Best Proactices) code which nsk110483 and all others can benefit...

nsk110483 : What do you think? Did we answer this for you? Or, would you like some more, generously offered, insight?
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report 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     [CLOSED] How does EVAL function

Copyright © 1996-2020 Information Builders