KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to get index types programmatically
PRODUCT: 4D | VERSION: 11.4 | PLATFORM: Mac & Win
Published On: September 10, 2009
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

The index type for a table can be obtained programmatically by querying the _USER_INDEXES table for the INDEX_TYPE field.

For example the index types for Table number 1 can be found with the following code:

ARRAY TEXT(Index_type;0)

Begin SQL
   SELECT INDEX_TYPE
   FROM _USER_INDEXES
   WHERE TABLE_ID=1
   INTO :Index_type;
End SQL


After execution, the Index_type array will be populated with index type numbers with the following corresponding values:

1B Tree index
3Cluster and Keyword Indexes
7Automatic Index

Commented by Jesse Pina on September 18, 2009 at 7:09 AM
Information regarding indexes is just another example of the different kinds of information that is available from the SQL system tables.