finding an index problem
Richard Kreiss
rkreiss at gccconsulting.net
Wed Apr 16 10:49:19 PDT 2008
A client called recently to tell me a sales report was giving an incorrect
total for a customer at a subtotal which uses @rs.
For this customer and item the total should have been 41 but the report
showed 42. Now, the item totals are all summary just listing the product
name and the number of purchase for the period.
Here was the problem; when run from my -v sel_sales processing for just this
customer, the product count was correct. When using the option to select
all customers, that's when the count was off.
Since no details are printed, I created an array to hold each product #
selected for that customer. Sure enough, one had 2 entries. Checking the
product file details showed only 1 record. The array was displayed as a
listbox at @done.
My next step was to set a second array to hold the record # for each item
selected. Again the record # was displayed twice. This, of course,
indicated that the item was being selected twice.
Since I was using a - lookup to process a specific range of customers, I had
only one select statement. When checking the processing for that customer
with the debugger, this item was selected only once. It wasn't until I
specifically turned on the debugger when that record number was read, that I
was able to confirm that the - lookup index was bad. Sort is cust #,
product #, in this instance the customer # was 1094 but the second instance
on the record was for customer 1126. Of course, the report generated its
own index so the product appeared twice for customer 1094.
Had to wait until 1 AM to rebuild the index as the system is used until at
least 9:30 PM on the West coast. After rebuilding the index, everything ran
properly.
Richard Kreiss
GCC Consulting
rkreiss at gccconsulting.net
More information about the Filepro-list
mailing list