PDA

View Full Version : Repairing Indexes


ABC123

Trimcom
03-03-2005, 04:28 PM
Hi,

New functions were added to Alpha Five version 6 in build 1549-2035 that was released January 4, 2005. The new functions are:

Get_Index_Definitions() Function - Returns a CRLF string of the definitions of all indexes (i.e. index tags) for a table.

Create_Indexes() Function - Creates indexes for a table based on a CRLF definition string that defines the indexes to be created. This function is a wrapper around the low level .Index_Create_Begin(), .Index_Add() and .Index_Create_End( functions.

Indexes_Match_DefString() - Checks the indexes in a table and compares them against a previously created index definition string. Allows you to tell if index tags are missing, or if index tags have been added. Used in conjunction with Get_Index_Defintions(), and Create_Indexes(), this function allows you to re-create the indexes for a table if they no longer match the required indexes.

Selwyn wrote two scripts using these to repair, or rewrite indexes if the get damaged or are missing.

My question: Why can't the same functions be created for v5, along with the same scripts? My indexes keep disapearing!

Stan Mathews
03-03-2005, 05:54 PM
They can, but why would you then pay for the upgrade to v6?

JerryBrightbill
03-03-2005, 07:00 PM
The bigger question is why are the indexes disappearing. They were very stable in V5. Rather than spending time with bandaids to fix it after the fact, time would be better spent trying to eliminate the cause in the first place. This has been discussed so many times, I can't think of a good search string to narrow it down. There is even a section in the V6 help file about it. It is copied below.

If Alpha Five cannot evaluate an index tag expression it will delete the index tag from the collection assigned to the given table. Possible reasons that an expression cannot be evaluated include:

-the use of reserved words as Names for variables

-the use of variables that have not yet been initialized, or which contain values that Alpha Five is not expecting

-a corrupted record with bad data

Jerry

CALocklin
03-05-2005, 05:16 AM
Although I agree with Jerry, you might also want to take a look at my index rebuild routine. I add this as a utility to all apps that I build - just in case. In one app it runs an automatic index update the first time a user starts the app in the morning and in another app I use it to force and index update before creating monthly invoices - just in case.

Although it was built before the new functions were added to v6, you might still think of it as a wrapper for Selwyn's newest functions. His new functions just make it easier for someone to do what I've already done. My routine doesn't just get a list of the current index definitions, it gets the list and converts that list to a complete script (function actually) to rebuild the indexes. The resulting function includes a dialog box and numerous choices (both developer choices and user choices) for how it is to be used.

I did not build anything to check for matching definitions because I didn't really see the need for it. Maybe that's because most of my index definitions have been stable - only the indexes themselves got corrupted when apps were used on networks with numerous simulataneous users. My philosopy - if the indexes don't work, rebuild them; if they work, don't rebuild them.

Cal Locklin
www.aimsdc.net

Trimcom
03-07-2005, 09:46 AM
Thanks, Jerry.

THE question is why are the indexes (all except one!) suddenly disapearing. I need to do some homework on that. But in the meantime, to enable my client to keep going, I need some utility. BTW, I purchased v6 but have not yet upgraded the client.

Thanks, TR

Trimcom
03-07-2005, 09:47 AM
Thank you very much, Cal,

I did order your program. Thank you very much.

TR