Jan,

 

Be careful using just one column name in your count, because if a row meets the 
where clause but the column itself is null, the selection still will be empty.

That’s why I am using the * in the count. Only in the case of that the column 
is a PK you can use one column in the count.

 

Tony

 

From: [email protected] [mailto:[email protected]] On Behalf Of jan johansen
Sent: vrijdag 11 mei 2012 22:34
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: error message

 

Javier,

 

Out of curiosity, I'm wondering if your code

-- 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

 

would operate faster as

SELECT (COUNT(equip_code)) INTO vcount INDIC ivcount +

FROM fuel_usage_file +

WHERE equip_code = .vequip_code AND +

fuel_date BETWEEN .vfrom_date AND .vto_date

 

Jan

 

-----Original Message-----
From: "Javier Valencia" <[email protected]>
To: [email protected] (RBASE-L Mailing List)
Date: Fri, 11 May 2012 14:58:21 -0500
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]] 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

Reply via email to