I just use the save variable (vCount) everywhere that I do count(*) in the 
manner Tony described.
I consider it a throw-away. I doesn't need to be cleared as it is used over and 
over.

I only use individual count variables when I need to keep several different 
counts for processing purposes, or I am going to check it in several places 
later in the code.
Then I name the count variables appropriately for clarity, and to avoid 
stepping on the value(s) by mistake..

Dennis McGrath
Software Developer
QMI Security Solutions
1661 Glenlake Ave
Itasca IL 60143
630-980-8461
[email protected]
________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of MDRD
Sent: Wednesday, January 04, 2012 4:47 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Win 7 problem

Thanks Karen

I do use Count(*) in several places but not everywhere, I was trying to avoid 
setting too many Vars and keeping track of them...

Marc


From: [email protected]<mailto:[email protected]>
Sent: Wednesday, January 04, 2012 4:40 PM
To: RBASE-L Mailing List<mailto:[email protected]>
Subject: [RBASE-L] - Re: Win 7 problem

I'm with Tony.  I never rely on SQLCODE to give me an error condition.
I do a count(*) first.  I've heard quite a few stories of SQLCODE giving
different results based on the computer's operating system.  And if my
count(*) is based on a large table, I will always add "and limit = 1" to
the end of my Select so that it stops counting as soon as it finds one
record.

Karen



In a message dated 1/4/2012 1:41:53 PM Central Standard Time, 
[email protected] writes:

Marc,

My way of dealing with this kind of queries is to make use of a COUNT, like:

Set var V_Count integer = 0

Select count(*) into V_Count indicator V_Count_ind +
from <tableview> +

WHERE (cust1 = .vcust1 OR cust2 = .vcust1 OR cust3 = .vcust1 +
OR cust4 = .vcust1) AND aptdate >.#DATE

If V_Count = 0 then

PAUSE 1 USING 'Needs to make an Apt' CAPTION 'No APts set'
ENDIF



BTW   Have you noticed the RETURN after ENDIF.

The routine will stop at that point



Tony


Reply via email to