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.

New TIBCO Community Coming Soon
In early summer, TIBCO plans to launch a new community—with a new user experience, enhanced search, and expanded capabilities for member engagement with answers and discussions! In advance of that, the current myibi community will be retired on April 30. We will continue to provide updates here on both the retirement of myibi and the new community launch.

What You Need to Know about Our New Community
We value the wealth of knowledge and engagement shared by community members and hope the new community will continue cultivating networking, knowledge sharing, and discussion.

During the transition period, from April 20th until the new community is launched this summer, myibi users should access the TIBCO WebFOCUS page to engage.


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