DlFieldGetAttribute - demographics_library - 2024.01

Demographics Library Reference for Windows and UNIX

Product type
Software
Portfolio
Locate
Product family
GeoStan Geocoding Suite
Product
GeoStan Geocoding Suite > Demographics Library
Version
2024.01
Language
English
Product name
Demographics Library
Title
Demographics Library Reference for Windows and UNIX
Copyright
2024
First publish date
1994
Last updated
2024-05-17
Published on
2024-05-17T02:16:20.391253

Returns attribute information about specified field.

Syntax

intl DlFieldGetAttribute (DlFieldId hfield, DlAttribute

which, char *buffer, intl bufSize)

Arguments

hfield

Handle to field object, as returned by DlFieldGet. Identifies the field for which attribute information is to be returned. Input

which

The specific attribute to return. Input.

Field Attribute Enum Description
DlName Field name
DlFieldname Field name as it appears in .DLD file
DlWidth Field width
DlDecimals Number of decimal places, if numeric
DlPrice Not implemented
DlLicenseType Not implemented
DlLicenseStatus Not implemented
DlDescription Short (32 character) description of field
DlHelp Long (256 character) description of field
DlNumvalues Number of unique values possible for field
DlType Field type; "N" (numeric) or "C" (character)

*buffer

Location to store the returned data. Output

bufSize

Maximum size of data to return in buffer. Input

Note: If the data returned by buffer is larger than the space allotted by bufSize, it will be truncated.

Return Value

Returns attribute information for specified field.

Notes

DlFieldGetAttribute is used to retrieve attribute information about a specified field within a .DLD file. This may include such information as field name and description, field size, and data types.

See Also

DlFieldGet, DlFieldGet, DlFieldGetValueAttribute

Example

See DlFieldGetN for an additional example.

// This code fragment "walks" through the data file, fetches each field's name,
// and prints it to both screen and buffer.
      ​
intl NumFields = DlFileNumFields(hFile);

if (NumFields<=0)
return;
      ​
fields = new DlFieldId[NumFields];
      ​
for (intl counter=0; counter < NumFields; counter++)
 {
 fields[counter] = DlFieldGetN(hFile, counter);
 if (fields[counter] == 0)
  {
  delete[ ]fields;
  return;
  }
 if(!DlFieldGetAttribute(fields [counter], DlName, string, 256) && string != "")
  {
  /* insert error-handling routines here */
  }
 else
  {
  sprintf(output, "Name: %s\n", string);
  printf(output);
  }
 }