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     Help with IF within a THEN phrase

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Help with IF within a THEN phrase
 Login/Join
 
Guru
posted
Hi,

I am trying to use the code below in a DEFINE and I am getting this error,
"(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: BEGIN
(FOC844) UNCORRECTABLE SYNTAX ERROR: IF"

I'm trying to use the same syntax shown in the "Nesting IF Commands" section of the WebFOCUS Language Reference. Can anybody tell me how to structure this so it will work in a DEFINE?

THANKS!

YR_PRIOR_96/D12=
IF (ENG_SOP LT 1960) THEN BEGIN
	IF ((&POP_YR - ENG_LIF_YRS) GT 1960) THEN BEGIN
		IF ((1996 - (&POP_YR - ENG_LIF_YRS)) LT 1) THEN 1 ;
		IF ((1996 - (&POP_YR - ENG_LIF_YRS)) GE 1) THEN (1996 - (&POP_YR - ENG_LIF_YRS));
	ENDBEGIN
	ELSE IF ((&POP_YR - ENG_LIF_YRS) LE 1960) THEN (1996 - 1960)
ENDBEGIN
IF (ENG_SOP GE 1960) THEN BEGIN
	IF ((&POP_YR - ENG_LIF_YRS) GT ENG_SOP) THEN BEGIN
		IF ((1996 - (&POP_YR - ENG_LIF_YRS)) LT 1) THEN 1;
		IF ((1996 - (&POP_YR - ENG_LIF_YRS)) GE 1) THEN (1996 - (&POP_YR - ENG_LIF_YRS));
	ENDBEGIN
	ELSE IF ((&POP_YR - ENG_LIF_YRS) LE ENG_SOP) THEN BEGIN
		IF ((1996 - ENG_SOP) LT 1.0) THEN 1;
		IF ((1996 - ENG_SOP) GE 1.0) THEN (1996 - ENG_SOP);
	ENDBEGIN
ENDBEGIN
ELSE 1;


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Expert
posted Hide Post
I took a look at what looks like the latest "Creating Reports With WebFOCUS Language Version 7 Release 6" document (wf761crlang.pdf) and did not find
quote:
Nesting IF Commands
.

I think the documentation you're referring to is for Maintain.


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
Guru
posted Hide Post
Well now... that would sure explain the "(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: BEGIN error now wouldn't it?

Bummer!

So, what do you think? Should I break each component down into a variable of its own and then do a simple IF THEN statement?

Thanks!

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Virtuoso
posted Hide Post
The code BEGIN and ENDBEGIN are IMHO typical Visualbasic codes.
Change it to ( and ) also the ";" are not correct codes, change them to "ELSE" I think that would work.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
quote:
BEGIN
IF ((1996 - (&POP_YR - ENG_LIF_YRS)) LT 1) THEN 1 ;
IF ((1996 - (&POP_YR - ENG_LIF_YRS)) GE 1) THEN (1996 - (&POP_YR - ENG_LIF_YRS));
ENDBEGIN


I don't think

BEGIN
ENDBEGIN

is a supported part of IF THEN structure.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Guru
posted Hide Post
FrankDutch,

Thanks for the replacement suggestions. That did the trick! I ended up with...

YR_PRIOR_96/D12=
IF (ENG_SOP LT 1960) THEN (
IF ((&POP_YR - ENG_LIF_YRS) GT 1960) THEN (
IF ((1996 - (&POP_YR - ENG_LIF_YRS)) LT 1) THEN 1
ELSE IF ((1996 - (&POP_YR - ENG_LIF_YRS)) GE 1) THEN (1996 - (&POP_YR - ENG_LIF_YRS))
)
ELSE IF ((&POP_YR - ENG_LIF_YRS) LE 1960) THEN (1996 - 1960)
)
ELSE IF (ENG_SOP GE 1960) THEN (
IF ((&POP_YR - ENG_LIF_YRS) GT ENG_SOP) THEN (
IF ((1996 - (&POP_YR - ENG_LIF_YRS)) LT 1) THEN 1
ELSE IF ((1996 - (&POP_YR - ENG_LIF_YRS)) GE 1) THEN (1996 - (&POP_YR - ENG_LIF_YRS))
)
ELSE IF ((&POP_YR - ENG_LIF_YRS) LE ENG_SOP) THEN (
IF ((1996 - ENG_SOP) LT 1.0) THEN 1
ELSE IF ((1996 - ENG_SOP) GE 1.0) THEN (1996 - ENG_SOP)
)
)
ELSE 1;


Regards,

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Platinum Member
posted Hide Post
quote:
The code BEGIN and ENDBEGIN are IMHO typical Visualbasic codes.


They are also legal, and useful Maintain commands !

I always remember IF-THEN-ELSE, IF-THEN-ELSE, IF-THEN-ELSE... to check my syntax in Defines. It's helped me write and fix complex Defines many times.


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
 
Posts: 165 | Location: Detroit Metro | Registered: September 17, 2003Report 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     Help with IF within a THEN phrase

Copyright © 1996-2020 Information Builders