I don’t see how the limit = 1 condition would improve the speed. Normally the where clause is evaluated from left to right (It depends on the AND setting).
If the last statement in the where clause is limit = 1, this one is performed after all other conditions have been met. So theoretically speaking it would slow down the performance. As a human being I would use the limit = 1 condition, but I think that’s the difference between me and my computer Or do I miss something? Tony From: [email protected] [mailto:[email protected]] On Behalf Of Javier Valencia Sent: zaterdag 12 mei 2012 4:37 To: RBASE-L Mailing List Subject: [RBASE-L] - RE: error message Jan, You are correct. I normally use the SELECT (COUNT(…); I have been gradually changing COMPUTE to SELECT and using, as Albert indicated, the LIMIT = 1 syntax. How ironic that the first snippet of code I grab is one with the old syntax, even when I completely updated the form where that code resides; I don’t know how I missed that. I need to do a search of all forms for COMPUTE and update the code. 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 jan johansen Sent: Friday, May 11, 2012 3:34 PM 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

