Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Index
Message
From
18/10/2002 13:01:01
 
 
To
18/10/2002 12:43:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00712933
Message ID:
00712960
Views:
19
Jim,
I can only surmise that the index is out of whack because 99% of the time this doesnt happen, and it is only happening on one site. If I look at the invoice header record it's total is wrong, but if I reindex then edit it, when it recalcs it is corrected. This is why I believe it is an index problem. Set Deleted is on. The amount being out is not a rounding issue, it appears to be an item from a different invoice. Does SQL select bi-pass indices, so if I

Select ... FROM ariitems GROUP by .. WHERE ... and NOT DELETED('ariitems'), will I get a better result?



>Sandi,
>
>Can you tell us what index is out of whack? Also, can you tell us the expression you used to create the index in the first place?
>
>You don't check that SEEK indeed FOUND a record. That would be a good thing to do.
>
>What is the current setting of (SET) DELETED? If it is OFF, then are there deleted records that can be being SUMmed too?
>
>I assume that your SEEK is to position the ARIITEMS table at the first qualifying record. In that case you might use the WHILE clause of SUM (instead of FOR).
>
>Is "arinvoic.AMOUNT" also calculated with the ROUND() function? A rounded "arsum" might not be exactly the same value as the calculation you are doing.
>
>good luck
>
>
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform