KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to simulate a composite index in 4th Dimension
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: August 6, 2008

The only index available in 4th Dimension prior to 4 v11 SQL is BTree. To be able to perform a query on two indexed fields you need to perform consecutive queries on both fields, or you can simulate a composite index. To do this you need to create a new field which contains the concatenated data from both fields. Then index the field and perform a query on this field.

For example instead of doing queries on ”FirstName” and “LastName” fields, lets say John Smith, you can create a third field “Name” which contains JohnSmith and perform only one query on the whole name. This will speed up your queries and will lower the number of indexes in your database, which is more desirable for index fields maintenance, searching and deletion of data.