Actually, even better: I always use ONE exit point for each block of code, AND
eliminate duplication as much as possible. Doing that with the ELSE is quite an
improvement:
$COMMAND
updates
-- test the variables
-- insert the data to the matlist table
--
IF invqty = 0 THEN
SET V invstatus TEXT = "Retry"
ELSE
SET ERROR V inverror
-- insert data
INSERT INTO matlist jobnum, mldate, qty, partnum, discript, +
price, product, margin, emp_mult +
VALUES (.invjobnum, .invmldate, .invqty, .invpartnum, .invdescript, +
.invprice, .invproduct, .invmargin, .invempmult)
IF inverror = 1 THEN
SET V invstatus TEXT = "Unsuccessful Insert"
ELSE
SET V invstatus TEXT = "Successfully inserted Data"
ENDIF
ENDIF
SET V invqty REAL = NULL
SET V invpartnum TEXT = NULL
SET V invdescript TEXT = NULL
SET V invprice CURRENCY = 0
SET V invproduct TEXT = NULL
SET V invbin1 = NULL
RECALC VARIABLES
SKIP TO invbin1
RETURN
Jim Blackburn
Kodiak
randyp wrote:
>
> Dan,
>
> Try using ELSE as part of your first IF statement:
>
> IF invqty = 0 THEN
> SET V invstatus TEXT = "Retry"
> SET V invqty REAL = NULL
> SET V invpartnum TEXT = NULL
> SET V invdescript TEXT = NULL
> SET V invprice CURRENCY = 0
> SET V invproduct TEXT = NULL
> SET V invbin1 INTEGER = NULL
> RECALC VARIABLES
> SKIP TO invbin1
> RETURN
> ELSE -- new
> -- ENDIF -- commented out
>
> SET ERROR V inverror
> -- insert data
> INSERT INTO matlist jobnum, mldate, qty, partnum, discript, +
> price, product, margin, emp_mult +
> VALUES .invjobnum, .invmldate, .invqty, .invpartnum, .invdescript, +
> .invprice, .invproduct, .invmargin, .invempmult
>
> IF inverror = 1 THEN
> SET V invstatus TEXT = "Unsuccessful Insert"
>
> SET V invqty REAL = NULL
> SET V invpartnum TEXT = NULL
> SET V invdescript TEXT = NULL
> SET V invprice CURRENCY = 0
> SET V invproduct TEXT = NULL
> SET V invbin1 INTEGER = NULL
> RECALC VARIABLES
> SKIP TO invbin1
> RETURN
> ENDIF
>
> SET V invstatus TEXT = "Successfully inserted Data"
>
> SET V invqty REAL = NULL
> SET V invpartnum TEXT = NULL
> SET V invdescript TEXT = NULL
> SET V invprice CURRENCY = 0
> SET V invproduct TEXT = NULL
> SET V invbin1 = NULL
> -- RECALC VARIABLES
> SKIP TO invbin1
>
> ENDIF -- new
> RECALC VARIABLES -- new
> -- you could also put SKIP TO invbin1 after the ENDIF
> -- and remove it from both lines above, to see what happens.
> RETURN
>
> Dan Champion wrote:
>
> > Heh, Hi all, me again...:)
> >
> > Since my upgrade from 6.5win to 6.5++ I have a problem I can't seem to
> > debug. In the code below (an exit eep from the second field of a form)
> > the first part (where invqty = 0) works great and DOES skip to invbin1.
> > the secont part (where invqty <> 0) does everything except skip to invbin1.
> > INstead, after the load table, and resetting the variable, it just sits
> > there and no amount of tab, enter, or space will bring you focus to the
> > form. Any Ideas what I have done wrong?
>
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: INTRO rbase-l
> ================================================
> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
> In the message body, put just two words: UNSUBSCRIBE rbase-l
> ================================================
> TO SEARCH ARCHIVES:
> http://www.mail-archive.com/rbase-l%40sonetmail.com/
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/