In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

UpdateIndex and RebuildIndex_Sub

With version 3.0, the rebuilding of indexes was made much more efficient. The engine behind this change is the subroutine RebuildIndex_Sub. This may be used by the developer to rebuild indexes on one or more fields within a table, under programmatic control with error reporting. As with the version 3.x indexing in general, rebuilds on multiple indexes are now much more efficient. In addition a new TCL command, UpdateIndex was added to permit the easy flushing of indexes from TCL.

The syntax of UpdateIndex is straightforward, as SysMessage W881 puts it

     The correct form for the "UPDATEINDEX" command is:

     UPDATEINDEX file_name field_name index_type

Note however, that ALL may be used in place of the file_name or field_name, and that the index_type seems to be at least the first letter of the respective index type, i.e. B for Btree, C for Cross reference and R for relational. Note further that the system will accept references to cross referenced fields by either their full name e.g. NAME_XREF or by their abbreviated form e.g. NAME.

RebuildIndex_Sub takes 5 parameters as follows

     DataTable, DataHandle, IndexHandle , FieldInfo , FlagAll

DataTable      The name of the table to which the indexes belong.

DataHandle     The table variable of the table to which the indexes belong.

IndexHandle    The table variable of the index table belonging to the
               indexed table.

FieldInfo      Field mark delimited array, having one field for each index
               to be updated. Within each field are ten multi-values
               describing a different aspect of the index to be updated. The
               apparent structure is as follows :-
               < 1 >  Name of the indexed column being updated. Note that in
                      the case of XREF indexes, the _XREF should be removed.
               < 2 >  The index type, as a word, these being Btree CrossRef
                      Related To
               < 3 >  Only used for "Related To" indexes. Contains the name
                      of the index description record in the ! file
                      describing the index, e.g. CUSTOMERS*INVOICE_KEYS*BOT
               < 4 >  Name to display in progress report on status line for
                      this index.
               < 5 >  Set to 1 for Btrees and Cross Refs and 2 for
                      relational.
               < 6 >  The column number being indexed, or in the case of
                      symbolic columns, the name of the column.
               < 7 >  Convert to uppercase flag, 1 for Yes, 0 for No.
               < 8 >  Justification of the data and key to index. I.E. RL to
                      give right justified data and left justified key.
               < 9 >  Sort order of the data and key to index. I.E. AD to
                      give ascending data and descending key.
               < 10 > Seems to be used as a flag as to whether the current
                      column is multivalued. If this flag is set then all
                      values in the column are indexed. If this flag is set
                      to false then only the first multivalue is indexed.
               Note that this is a major departure from the old default
               state that ALL multi values were indexed regardless of
               whether the dictionary item was declared as MVed.


FlagAll        A flag used if the developer knows that they wish to rebuild
               all of the indexes in a table. Note that RevTI sources
               indicate that this should only be used if the developer is
               confident that ALL indexes in the table are nominated in
               FieldInfo.
(Volume 4, Issue 10, Pages 5-7)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel