Retrieving information about a field in a secondary index

IndexFieldProp()

Retrieve information about a specified field in a secondary index


SYNTAX

IndexFieldProp(pathname, indexnum, fieldnum, propnames, propvalues)

Retrieve information about a specified secondary index data dictionary field.

pathname

The path of the data dictionary (.d) file to be read.

indexnum

The number of the index, where 1 represents the first secondary index defined, 2 represents the second, etc. The OpenDotd() function returns the number of indexes defined for a data dictionary, and the OpenIndex() function returns the name and number of fields in a specified index.

fieldnum

An integer value representing the number of the field, starting from 1.

propnames

Alphanumeric array of DOTD_NUMPROP (14) elements. The array is filled with the property names - briefer versions of the descriptions listed below. This argument may be NULL.

propvalues

Alphanumeric array of DOTD_NUMPROP (14) elements. Those elements of the array that are relevant to secondary index fields are filled with the property values. This argument may be NULL, though this is not recommended. The values returned are:

1

The field name

2

type, e.g. a = alphanumeric, i = integer

3

size in bytes

6

format string

14

element (if corresponding main index field is an array field)

The function returns 0 if the arrays are successfully filled.

If the data dictionary could not be read the function returns -1. This may be because it does not exist, or because the user doesn’t have the necessary permission, or may be a file format error. It also returns -1 if the specified index or index field does not exist.


NOTES

  • The OpenDotd() function returns general information about a data dictionary, and the FieldProp() function returns properties of a specified field in it. The OpenIndex() function returns general information about a secondary index.

  • If the propnames or propvalues array is dimensioned to less than DOTD_NUMPROP, the function fills the elements available. If the dimension is greater, the excess elements are ignored.

  • DOTD_NUMPROP is defined in <sculptor.h>.


EXAMPLE

!temp NumFields,,i2
!temp NumKeys,,i2
!temp NumIndexes,,i2
!temp IndexNo,,i2
!temp IndexName,,a50
!temp NumIndexFields,,i2
!temp IndexFieldNum,,i2
!temp PropNamesArray,,a20[DOTD_NUMPROP]
!temp IndexPropArray,,a50[DOTD_NUMPROP]

     OpenDotd(DDPath, NumFields, NumKeys, NumIndexes)

     for (IndexNo = 1; IndexNo <= NumIndexes; IndexNo ++) {
          OpenIndex(DDPath, IndexNo, IndexName, NumIndexFields)

          for (IndexFieldNum = 1; IndexFieldNum <= NumIndexFields; IndexFieldNum ++) {
               IndexFieldProp(DDPath, IndexRealNum, IndexFieldNum, PropNamesArray, IndexPropArray)
               statements to process this index
          }
     }

RELATED TOPICS

OpenDotd()

FieldProp()

OpenIndex()

Data dictionaries

Secondary indexes

Data fields