KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Reindexing tip and trick
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: January 21, 2000
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Sometimes indices get corrupted and exhibit unexpected results, such as, returning the incorrect selection of records. One way of dealing with this problem is to reindex the index. There are few ways to reindex. The approach presented in this tech tip is to remove the index (or indices) and let 4D rebuild it (them).

When reindexing a problem index, it is preferrable to reindex all related indices. If all indices for a table are not removed and rebuilt, sometimes a problem with an index will persist after the index is recreated.

One convenient way of reindexing multiple indices in a data file is to work with 2 copies of the structure file. One copy of the structure file will be remain the same -- we will refer to this as the 'original' copy of the structure file. The second copy of the structure file will be referred to as the 'deindex' copy -- this is used to deindex the data file.

The steps are:


  1. Open the deindex structure file with a new data file.
  2. Go to the design mode and open the structure editor.
  3. Remove all the indexes that you want to rebuild.
  4. Open the old data file with the deindex structure file.
  5. 4D will automatically remove all the indices. (This may take several minutes)
  6. Quit 4D. Again this may take a while as 4D might need time to write all the changes to the hard drive.
  7. Open the original copy of the structure file with the old data file that was just deindexed.
  8. 4D will automatically recreate the indexes.