VECGetFieldName and VECGetFieldType

Demonstrate how to retrieve the name and types of the layer.

Remarks

This example illustrates how to get the field names and types of a layer.

Code

 local integer shape, integer layer, integer count, integer field
 local integer tfid, integer i
 
 tfid = DBOpen( GetPCIHOME() + "/demo/irvine.pix", "r")
 layer = 31
 count = VECGetFieldCount(tfid, layer)
 shape = VECNextShape(tfid, layer, -1)
 While shape <> -1
   print
    print "Shape ", shape
    for i = 1 to count
        local string fieldname 
        local string fieldtype 
        fieldname = VECGetFieldName(tfid, layer, i)
        fieldtype = VECGetFieldType(tfid, layer, i)
        Print "Field ", fieldname, " is of type ", fieldtype
    endfor
    shape = VECNextShape(tfid, layer, shape)
 endwhile
 Call DBClose(tfid)

Output

Shape 297
Field AREA is of type Double
Field PERIMETER is of type Double
Field LULC# is of type Integer
Field LULC-ID is of type Integer
Field ATTRIBUTE is of type Double
Field GROUP is of type Double
Field ArcIdList is of type CountedInt

Output

Field AREA       is of type Double
Field PERIMETER  is of type Double
Field LULC#      is of type Integer
Field LULC-ID    is of type Integer
Field ATTRIBUTE  is of type Double
Field GROUP      is of type Double
Field ArcIdList  is of type CountedInt

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.