Razzak,

Thank you. I was actually replacing the existence check with this when I 
posted the question.
I think elsewhere in the system when I look at
WHILE SQLCODE = 0
or
WHILE SQLCODE <> 100
my brain got really tied in knots.

Thx again,

Jan


From: "A. Razzak Memon" <[email protected]>
To: [email protected], [email protected]
Date: Tue, 05 Feb 2019 20:28:00 -0500
Subject: Re: [RBASE-L] - SQL tutorial


Jan,

Here is one approach to validate the existence of a row ...

SET VAR vRows INTEGER = 0
SELECT COUNT(*) INTO vRows INDICATOR iv1 FROM PODetail WHERE PO_ID =
.vPOID AND ReceiptStatus = 'P'

IF vRows = 0 THEN
    CLS
    PAUSE 2 USING 'No record found!' CAPTION 'Receipt Status' ICON WARNING +
    BUTTON 'Press any key to continue ...' +
    OPTION BACK_COLOR WHITE +
    |MESSAGE_FONT_NAME Tahoma +
    |MESSAGE_FONT_COLOR RED +
    |MESSAGE_FONT_SIZE 12
    GOTO Done
ENDIF

-- Do what you have to do here ...
-- Example
    CLS
    EDIT USING ReceiptStatus WHERE PO_ID = .vPOID AND ReceiptStatus = 'P'
LABEL Done
    CLEAR VARIABLES iv%,vRows
    RETURN

Hope it helps!

Razzak


At 06:41 PM 2/5/2019, jan johansen wrote:

>All,
>
>I think I need a SQL refresher.
>I need to update old code that looks like this.
>
>SET ERROR VAR hold
>SET VAR vchk = ReceiptStatus IN PODetail WHERE PO_ID = .vPOID AND
>ReceiptStatus = 'P'
>IF hold = 0 THEN
>
>So is
>IF hold = 0 the same as
>IF SQLCODE = 0?
>
>Sorry such a dumb question.
>
>Jan
>
>--
>For group guidelines, visit
><http://www.rbase.com/support/usersgroup_guidelines.php 
[http://www.rbase.com/support/usersgroup_guidelines.php]>http://www.rbase.com/support/usersgroup_guidelines.php
 
[http://www.rbase.com/support/usersgroup_guidelines.php]
>---
>You received this message because you are subscribed to the Google
>Groups "RBASE-L" group.
>To unsubscribe from this group and stop receiving emails from it,
>send an email to
><mailto:[email protected] 
[mailto:rbase-l%2Bunsubscribe%40googlegroups.com]>[email protected]
 
[mailto:rbase-l%2Bunsubscribe%40googlegroups.com].
>For more options, visit
><https://groups.google.com/d/optout 
[https://groups.google.com/d/optout]>https://groups.google.com/d/optout 
[https://groups.google.com/d/optout].

--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php 
[http://www.rbase.com/support/usersgroup_guidelines.php]
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected] 
[mailto:rbase-l%2Bunsubscribe%40googlegroups.com].
For more options, visit https://groups.google.com/d/optout 
[https://groups.google.com/d/optout].

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to