I have an app made for a cosmetics lab (they make lipsticks, nail 
enamel, face creams of all kinds, you name it). For legal reasons, they 
are subject to the local government department of health audits and they 
must have a batch identification number, as well as a unit number, so in 
case the Government needs to trace one particular item or one particular 
batch, the program has all necessary data saved in ad hoc tables.

The way it works is that every time a manufacturing order is processed 
for say a batch of nail enamel, it will be made for so many bottles. 
Each bottle will have a label stuck to it with the bottle contents, 
formula, batch number, date manufactured and unit number.

The table designed to contain all this info has a primary key, derived 
from an autoincremental field.

In the load event of the form I create an empty cursor adapter for this 
table with a select statement that looks like

select * from .... where 1=0

At the time of saving, this cursor adapter is part of a transaction.

A for-next loop generates each record that will be saved (sequential  
part number, etc) and saves with this snippet:

for I = 1 to nNumberOfBoxes
     cPartNo = 'XXXX'+alltrim(str(i)) && the code details don't matter here

     insert into (all fields) values(all values and cPartNo)

endfor
tableupdate(.t. ,.t.) && bulk update at the end of the loop (this is the 
one I use)

And alternative would be:

for......
     cPartNo = .............
     insert .....
     tableupdate(1,.t.) && individual update, one for each part number
endfor

My problem is that very often the compound index for this table is 
corrupted. I checked the network cards, the cable connections,put 
exceptions in the antivirus (dbf, cdx, fpt, dbc,dbt,dbx) so it will not 
affect my app, put a flush statement after the end transaction command. 
The tables reside in a Windows 2003 Server and the terminals are XP Prof 
and some W7.

And yet, the index is screwed almost every day. This is a high volume 
routine, there are dozens of manufacturing orders every day and several 
users issue them, according to the production run of the day.

I think that the way of bulk recording shown in the first example plus 
the fact that I use an autoincremental field might be causing the problem.

However, I am at a loss to determine the reason.

Is there anything you guys could advise?

(VFP 9 SP1)

TIA

Rafael Copquin





--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to