The NWFieldDescriptions collection lets you add field types to a specified layout in the NDs Schema. It allows you to manage and reference NWFieldDescription objects.You can use this object to:
Add a field type to a layout.
Return a count of the objects in the collection.
List fields of a layout.
Returns the number of field description objects it contains.
object.Count
Long.
Read-only.
This example returns the number of fields in a layout.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts
’ Display all the fields of user layout
Set userLayout = Layouts.Item ("User")
Set userFields = userlayout.Fields
Print "Total number of Fields in the User Layout: "&UserFields.Count
Initializes the collection for the enumeration of NWFieldDescription objects.
object.Reset()
None.
Void.
This example returns all the NWFieldDescription objects.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts
’ Display all the fields of user layout
Set userLayout = Layouts.Item ("User")
Set userFields = Userlayout.Fields
Print "Total number of Fields in the User Layout: "&userFields.Count
userFields.Reset()
While UserFields.HasMoreElements()
Set UserField = UserFields.Next()
Print "The user field is: "&UserField.Name
Print Userfield.Optional()
Wend
Returns the next NWFieldDescription object from the collection.
object.Next()
None.
NWFieldDescription.
This example returns the next NWFieldDescription object in the collection.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("user", "password")
Set Layouts = nwdir.Layouts()
’Display all the fields of user layout
Set UserLayout = Layouts.Item ("User")
Set UserFields = userlayout.Fields()
Print "Total number of Fields: "&UserFields.Count
UserFields.Reset()
While UserFields.HasMoreElements()
Set UserField = UserFields.Next()
Print "The name: "&UserField.Name
Print "The field is optional: "&UserField.Optional
Wend
Determines whether or not any more Entry objects exist in the collection based on the specified path.
Object.HasMoreElements()
None.
Boolean.
Returns true if the collection contains some more NWFieldDescription objects.
This example returns all NWFieldDescription objects in the specified path.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Layouts = nwdir.Layouts()
’ Display all the fields of user layout
Set UserLayout = Layouts.Item ("User")
Set UserFields = userlayout.Fields
Print "Total number of Fields in the User Layout: "&UserFields.Count
UserFields.Reset()
While UserFields.HasMoreElements()
Set UserField = UserFields.Next()
Print UserField.Name
Print UserField.Optional
Wend
Returns a NWFieldDescription object for the given index.
object.Element(
Index As Variant)
Index can be either numeric or string. The string value represents the field name.
NWFieldDescription.
This example returns the NWFieldDescription object for the specified index.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("user", "password")
Set Layouts = nwdir.Layouts()
’ Display all the fields of user layout
Set UserLayout = Layouts.Element("User")
Set UserFields = Userlayout.Fields()
Print "Total number of Fields in the User Layout:
"&UserFields.Count
UserFields.Reset()
While UserFields.HasMoreElements()
Set UserField = UserFields.Next()
Print "The name is: "&UserField.Name
Print "The field is optional:"&UserField.Optional
Wend
Set SurnameField = UserFields.Element("SurName")
Print SurnameField.Name
Returns a NWFieldDescription object for the given Index.
object.Item(
Index As Variant)
Index can be either numeric or string. The string value represents the field name.
NWFieldDescription.
This example returns the NWFieldDescription object for the specified index.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("user","password")
Set Layouts = nwdir.Layouts()
’ Display all the fields of user layout
Set UserLayout = Layouts.Element("User")
Set UserFields = Userlayout.Fields()
Print "Total number of Fields in the User Layout:
"&UserFields.Count
UserFields.Reset()
While UserFields.HasMoreElements()
Set UserField = UserFields.Next()
Print "The name is: "&UserField.Name
Print "The field is optional:"&UserField.Optional
Wend
Set SurnameField = UserFields.Element("SurName")
Print SurnameField.Name
Adds a field to the NDS Schema.
object.AddElement(
FieldName As String)
Name of the desired field.
NWFieldDescription.
This example shows how to add an NWFieldDescription object into NDS Schema.
Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login "User", "Password"
’Create a new field type
NewFieldTypeName = "NSN FieldType"
Set FieldTypes = nwdir.FieldTypes
FieldTypes.AddElement (NewFieldTypeName, SYN_CI_STRING)
’ Add new field type into NSN Layout
Set NewLayout = nwdir.Layouts.Element("NSN Layout")
NewLayout.Fields.AddElement ("NewFieldTypeName")
If (Err.Number = 0) Then
Print "New field is added to the Layout"
Else
Print "Failed to new field"
End If
Modifies the NDS Schema by adding a new field to the layout for which this field description object belongs.
object.Add(
FieldName As String)
Name of the desired field.
NWFieldDescription.
This example shows how to add a field into NDS Schema.
Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login "User", "Password"
’ Create a new field type
NewFieldTypeName = "NSN FieldType"
Set FieldTypes = nwdir.FieldTypes
FieldTypes.Add NewFieldTypeName, SYN_CI_STRING
’ Add new field type into NSN Layout
Set NewLayout = nwdir.Layouts.Element("NSN Layout")
NewLayout.Fields.Add ("NewFieldTypeName")
If (Err.Number = 0) Then
Print "New field is added to the Layout"
Else
Print "Failed to new field"
End If