ArcPad Scripting Object Model
Properties Property
See Also  Example  Send comments on this topic.
Property
Required. A String that specifies the property name.
Field Object : Properties Property

Glossary Item Box

Description

Returns or sets the specified property for the Fields.

Property type

Read-write property

Syntax

object.Properties ( Property ) = [ value ]

Parameters

Property
Required. A String that specifies the property name.

Return Type

Variant

Remarks

The Properties property is used to get or set the value of field properties that are accessed less often. The following properties are supported:
Name Description Return Type Read-only or read/write
READONLY True if the field is read-only; False, otherwise. Boolean Read-only
HIDDEN True if the field is hidden; False, otherwise. Boolean Read-only
ISGEOMETRY True if the field is a geometry field; False, otherwise. Boolean Read-only
NULLABLE True if the field is nullable; False, otherwise. Boolean Read-only
ALIAS The alias of the field (this is what gets displayed in the ArcPad UI). String Read-only

Example

Field Properties 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

© 2012 All Rights Reserved.