KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to get the names of fields that are indexed
PRODUCT: 4D | VERSION: 2004.3 | PLATFORM: Mac & Win
Published On: April 14, 2006

The code below will retrieve the names of fields in a table that are indexed and put the names in an array.

ARRAY TEXT(asFields;0)

C_INTEGER($vlField;$tableNum;$vType;$vLength)

C_BOOLEAN($vIndex;$vUnique;$vInvisible)

$tableNum:=Table(->[Table 2])

For ($vlField;1;Count fields($tableNum))  `Get all field names of table

      GET FIELD PROPERTIES($tableNum;$vlField;$vType;$vLength;$vIndex;$vUnique;$vInvisible)

      If ($vIndex=True)

         APPEND TO ARRAY(asFields;Field name($tableNum;$vlField))

     End if

End for