ArcPad Scripting Object Model
Name Property
See Also  Example  Send comments on this topic.
Field Object : Name Property

Glossary Item Box

Description

Returns the name of the field.

Property type

Read-only property

Syntax

variable = object.Name

Return Type

String

Example

Demonstrates reading extra field properties. Note that these properties are only supported for RecordSets returned from DataSource objects.
Field Properties Example (VBScript)Copy Code
Function OpenAXF(p_strAXFPath)
      Dim pDS
      Set pDS = Application.CreateAppObject("DataSource")
      pDS.Open(p_strAXFPath)
      If (pDS.IsOpen) Then
            Set OpenAXF = pDS
      Else
            Set OpenAXF = Nothing
      End If
End Function

Function GetFileNameUI(p_extension, p_filter, p_title, p_flags) 
      GetFileNameUI = CommonDialog.ShowOpen(p_extension, p_filter, p_title, p_flags)
      If (IsEmpty(GetFileNameUI)) Then
            GetFileNameUI = ""
      End If
End Function

Sub ShowAllFieldProperties(p_strLayerName)
      Dim strFileName
      strFileName = GetFileNameUI("axf", "ArcPad AXF Files|*.axf","Select AXF File", &H1000)
      If ("" = strFileName) Then Exit Sub

      Dim pDS
      Set pDS = OpenAXF(strFileName)
      If (pDS Is Nothing) Then
            Console.Print "Open DataSource failed"
            Exit Sub
      End If

      '++ open the passed in layer name
      '++ (note there is no error handling or validation in this sample!!)
      Dim pRS
      'Set pRS = pDS.OpenLayer(p_strLayerName,Map.Extent,"[LANDUSE_ID] < 2000")
      Set pRS = pDS.OpenLayer(p_strLayerName)


      If (Not pRS Is Nothing) Then
            Console.Print "Number of fields: " & pRS.Fields.Count
            Dim pField
            For each pField In pRS.Fields
                  Console.Print "Field name: " & pField.Name
                  Console.Print "   READONLY: " & pField.Properties("READONLY")
                  Console.Print " HIDDEN: " & pField.Properties("HIDDEN")
                  Console.Print "   ISGEOMETRY: " & pField.Properties("ISGEOMETRY")
                  Console.Print " NULLABLE: " & pField.Properties("NULLABLE")
                  Console.Print "   ALIAS: " & pField.Properties("ALIAS")
            Next
            '++ close the RecordSet
            pRS.Close
            Set pRS = Nothing
      End If

      '++ close the DataSource
      pDS.Close
        Set pDS = Nothing
End Sub

'++ call ShowAllFieldProperties with the layer Parks
'++ note there is a Parks layer in the sample Riverside.axf installed with ArcPad
Console.Clear
Call ShowAllFieldProperties("Parks")

See Also

© 2013 All Rights Reserved.