Marc,
 
I agree with you that it's probably not the code but probably a data
operator error. Of course all code can always be improved.
 
I have had instances where the data operator has blown right by the pause 1
or pause 2 message without having looked at or acknowledged the error
message. 
 
To counteract that from happening, I would create a small form based on a
dummy table that  contained the error message ('Some data was not copied to
the History file '). The data operator would have to press the [Esc] key not
'any key' to continue. 
 
Create the form and under Form Properties, go to the Dynamic Caption tab and
check all 4 boxes under Caption Buttons. This will force the data operator
to press the [Esc] key to acknowledge the message.
 
Hope that helps.
 
 
Bill Eyring


  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Marc
Sent: Tuesday, February 26, 2008 9:38 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - How can make this code better ?


Hi
 
Out of 100 offices this has happened only about 6 times in a year.  I think
it is from 
computer hiccups but I am wanting to make my code as tight as possible.
 
Basically we put charges and payments in a Tran_daily file.  At the end of
the day
if everything is correct we Close the day, do some updates, move the charges
and
payments to the Tran_Hist table and summaries the totals in a Recap table
with the
date on it, then delete the Tran_daily rows.
 
About 90% of the rows from the Tran_daily table got copied (inserted) into
the Tran_Hist
table twice for 2/8/08.  This office has used my app for 10 years and this
is the first time 
it has happened to them.  I told them if the same code works 99% of the time
and one day
screws up it is not the code/RBase it is a computer quirk.
 
 
 
Below is a summary of the code, is there a better way to do this or trap for
errors?
Sorry this is so long
Marc
 

 DELETE DUPLICATES FROM tran_daily  --so this should have stopped the dups
in the Hist
 
 SET VAR vdaycnt INTEGER = NULL
 SELECT COUNT (*) INTO vdaycnt FROM tran_daily
 SET VAR vhistcnt INTEGER = NULL
 SELECT COUNT (*) INTO vhistcnt FROM tran_hist
 
 -- copy tran_daily TO tran_hist
 INSERT +
 INTO tran_hist (custnum,date ......... +
 ................,modf4  FROM tran_daily
 
 SET VAR vhistcnte INTEGER = NULL
 SELECT COUNT (*) INTO vhistcnte FROM tran_hist
 IF vhistcnte <> (.vdaycnt + .vhistcnt) THEN
   PAUSE 1 USING 'Some data was not copied to the History file '
 ENDIF
if this poped up they didn't remember it

 *(insert RECAP FILE WITH TOTALS FOR DAY)
 INSERT INTO recap (............ , tptpay,+
 VALUES (.vdate, ................ '1',.vtvisa)

 DELETE ROWS FROM tran_daily
 
 SET VAR vrecapchar CURRENCY = 0.00
 SET VAR vrecappay CURRENCY = 0.00
 SET VAR vrecapchar CURRENCY = tcharges IN recap WHERE COUNT = LAST
 SET VAR vrecappay CURRENCY = tpayment  IN recap WHERE COUNT = LAST
 
 IF tcharge =  .vrecapchar AND totpay = .vrecappay THEN
   PAUSE 1 USING 'Finished Recap Created' ICON confirm  ....
  ELSE
   PAUSE 1 USING +
   'Recap DID NOT match Check the Recap and use a Backup if necessary' +
   ICON SERIOUS BUTTON 'OK' OPTION BACK_COLOR 65535 | ...+

if this poped up they didn't remember it
 ENDIF
 
 RECALC VARIABLES
 RETURN

Reply via email to