Focal Point
[SOLVED] (FOC266) IF ..THEN.. ELSE SYNTAX ERROR

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4597046776

August 05, 2015, 08:43 AM
Trudy
[SOLVED] (FOC266) IF ..THEN.. ELSE SYNTAX ERROR
I am getting a syntax error message on the following IF THEN ELSE statement.

IF J1.SEG01.LICENSE EQ '' THEN J0.SEG01.NONABACARDNUMBER ELSE J1.SEG01.LICENSE

I am trying to say if the field LICENSE is null then use NONABACARDNUMBER else use LICENSE

I am new to webfocus and couldn't find a function and/or not sure how to handle the 'null' scenario in a report section of a procedure.

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


WF8
Windows
August 05, 2015, 09:01 AM
Tomsweb
What is the size and format of the 2 fields you're using in the if,,,then,,,else?
The field on the left if the = sign must be the same size and format of those on the right side of the = sign.

Please show us the entire line of code.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
August 05, 2015, 09:03 AM
Tomsweb
You also need to put a semicolon at the end of the expression.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
August 05, 2015, 10:05 AM
Tewy
Use IS MISSING for a null test.

IF J1.SEG01.LICENSE IS MISSING THEN J0.SEG01.NONABACARDNUMBER ELSE J1.SEG01.LICENSE


WF 7.6.11
Output: HTML, PDF, Excel
August 05, 2015, 10:21 AM
CoolGuy
As Tewy points out, you can use IS MISSING to test for missing data, but you can also use the IS-NOT MISSING syntax to test that there is data present.


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
August 05, 2015, 11:13 AM
Tony A
You might find this link of use.

You might want to check out the use of SET MISSING = ON/OFF, (also SET HOLDMISS and SET COMPMISS) and how they might change the way you check for missing values in differing data sources (e.g. RDBMS, HOLD files etc.)

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 05, 2015, 11:48 AM
SDALSTON
quote:
IF J1.SEG01.LICENSE EQ '' THEN J0.SEG01.NONABACARDNUMBER ELSE J1.SEG01.LICENSE

You might also want to check for blanks:

IF J1.SEG01.LICENSE EQ MISSING THEN J0.SEG01.NONABACARDNUMBER ELSE
IF J1.SEG01.LICENSE EQ ' ' THEN J0.SEG01.NONABACARDNUMBER ELSE
J1.SEG01.LICENSE
August 06, 2015, 08:04 AM
Trudy
Thanks folks I believe the issue is with checking from the Nonabacardnumber which is an I11 type and Licence is an A6 type. I did an FPRINT(ABACARDNUMBER,'I11','A11') to convert it and then tried the SUBSTR on that define and still couldn't get it to work. Anyone have ideas on how to convert an I11 to an A6? The field never has anything more than 6 characters in it.


WF8
Windows
August 06, 2015, 08:20 AM
Tony A
With FPRINT, the incoming format does not have to fully represent the actual format of the column that you are converting -

FPRINT(ABACARDNUMBER,'I6','A6')

or with leading zeroes

FPRINT(ABACARDNUMBER,'I6L','A6')

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 06, 2015, 03:11 PM
Trudy
[SOLVED]


WF8
Windows