General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
I have a problem with an index that got out of wack. I have two tables, invoice header and invoice items. The total on the invoice header is supposed to be equal to the total on the items. In the case of the wacked out index this isnt true, but because the index is picking up the wrong information, it thinks its true. I have a routine in my posting run that checks the totals and stops posting, but if the index is out of wack it doesnt catch it. I need it to. In my posting run I call a method that contains:
METHOD artotalchk
*****************
LOCAL arsum, llOK
SELECT ariitems
SEEK STR(arinvoic.REFNO,6)
SUM ROUND(qty*amount,2) TO arsum FOR refno = arinvoic.REFNO
SELECT arinvoic
IF arsum <> arinvoic.AMOUNT - arinvoic.gstamt - arinvoic.pstamt
DO printerr WITH "Invoice reference "+alltrim(str(arinvoic.REFNO))+" header/item mismatch"
m.llOK = .F.
ELSE
m.llOK = .T.
ENDIF
I am wondering if there is another way that would avoid the index that could be corrupted. I think the index corruption is happening somewhere else and the customer isnt aware of it, so they dont reindex and data is being stored erronenously.
TIA,
Sandi
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only