I do not believe IF can take a select statement.

Instead use
SELECT COUNT(*) into vCount FROM PART_RELATE where Partnum = . vPartChoice and 
limit = 1
IF Vcount = 0 then
    -- put not found code here

ELSE
    -- put found code here
ENDIF

Dennis McGrath

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Jim Belisle
Sent: Monday, August 24, 2009 9:44 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - [No Subject]

I get an error for the below command 'Syntax is incorrect for the command IF'
vPartChoice is defined prior to this statement and comes up correctly when I 
SHOW VAR.
PART_RELATE is a table and the column names I am using are correct.

SET VAR vPartnew TEXT = NULL
IF vPartChoice = (SELECT Partnum FROM PART_RELATE) THEN +
    SET VAR vPartnew = Partrelate FROM PART_RELATE +
    WHERE Partnum = .vPartchoice
    SET VAR VFormMode = 'EDIT'
    EDIT USING KPRAssyPartGrid WHERE Assembly# = .vPartnew +
    ORDER BY PartNum
ELSE
    SET VAR VFormMode = 'EDIT'
    EDIT USING KPRAssyPartGrid WHERE Assembly# = (.vPartchoice) +
    ORDER BY PartNum
ENDIF

Jim

Reply via email to