I use an old syntax for this:
SELECT COUNT(*) INTO vCount from WHERE <clause> AND LIMIT = 1
As soon as it finds a matching record, it is finished.
Albert
On 11/05/2012 3:32 PM, Dan Goldberg wrote:
I will do a count from now on to avoid the warning message. I hope it
does not slow down too much.
I am thinking that my command(currently using) below would work faster:
SET VAR vecheck = partnumber FROM tablename where something = something
I am thinking this finds the first row that meets the clause and does
not have to cycle through the whole table.
Dan
*From:* Javier Valencia <mailto:[email protected]>
*Sent:* Friday, May 11, 2012 12:58 PM
*To:* RBASE-L Mailing List <mailto:[email protected]>
*Subject:* [RBASE-L] - RE: error message
Dan,
Here is a snippet of code I use in similar circumstances. In this case
to display records for a time period:
==========
LABEL Resel
SET VAR vfrom_date DATE = (RDATE(1,1,(IYR(.#DATE))))
SET VAR vto_date DATE = (.#DATE)
--Form date_from_to allows the user to enter a date range. It has
several preset date ranges
EDIT USING date_from_to
-- Check if user slected range or cancelled
IF ( vprint <> 'Y' ) THEN
SET VAR vresel = 'N'
GOTO Done
ENDIF
-- Check if records are available
COMPUTE vcount AS COUNT equip_code FROM fuel_usage_file +
WHERE equip_code = .vequip_code AND +
fuel_date BETWEEN .vfrom_date AND .vto_date
IF ( vcount > 0 ) THEN
BROWSE USING fuel_usage_list WHERE equip_code = .vequip_code AND +
fuel_date BETWEEN .vfrom_date AND .vto_date +
ORDER BY fuel_date DESC, fuel_time DESC
ELSE
PAUSE 2 USING 'No Fuel Usage Records found for this Time Period...' +
CAPTION 'System Message...' ICON ATTENTION
GOTO Resel
ENDIF
LABEL DONE
CLEAR VAR vcount, vfrom_date, vto_date
RETURN
==========
This approach prevents message displays and informs the user if
records are not available.
I have another approach that as soon as the user selects the time
period, the number of available records is displayed in the same form;
if 0 the user can either cancel or enter a new time period.
Javier,
Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137
*From:*[email protected] [mailto:[email protected]] *On Behalf Of *Dan
Goldberg
*Sent:* Friday, May 11, 2012 1:32 PM
*To:* RBASE-L Mailing List
*Subject:* [RBASE-L] - RE: error message
I will have to change my thought process. I do not like to give the
user the standard error messages....
Dan
*From:*Tony IJntema <mailto:[email protected]>
*Sent:*Friday, May 11, 2012 6:52 AM
*To:*RBASE-L Mailing List <mailto:[email protected]>
*Subject:*[RBASE-L] - RE: error message
As it said, it is a warning not an error.
I assume
Another way to avoid this message is to perform a count on beforehand,
like ‘select count(*) into V_counter indicator VIND_counter from
<tableview> where <clause>’
If V_Counter > 0 then
…
This last option is often used by me, it creates more control in the
application
Tony
*From:*[email protected] <mailto:[email protected]>
[mailto:[email protected]] <mailto:[mailto:[email protected]]> *On
Behalf Of *Dan Goldberg
*Sent:* vrijdag 11 mei 2012 15:23
*To:* RBASE-L Mailing List
*Subject:* [RBASE-L] - error message
I have some code that includes
set messages off
set error messages off
But I still keep getting the warning:
<WARNING> No rows exist or satisfy specified clause (2059)
The only way to turn it off is by using
set error message 2059 OFF
Shouldn’t the “set error messages off” turn off all error messages?
Dan Goldberg
No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 2012.0.2171 / Virus Database: 2425/4991 - Release Date: 05/11/12