The NWFieldTypes collection represents a set of NWFieldType objects. The collection allows you to add, delete, count, and access layouts.
Use this object to:
Create a new field type.
Return a count of the objects in the collection.
Select the object from the collection.
Gives the count of field types in the NDS Schema.
object.Count
Long.
Read-only.
This example lists the number of FieldTypes in the NDS schema.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set FieldTypes = nwdir.FieldTypes
Print "Total number of field types: "&FieldTypes.Count
Initializes the collection for the enumeration with all the NWFieldType objects.
object.Reset()
Void.
This example lists the number of FieldTypes in the NDS schema.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set FieldTypes = nwdir.FieldTypes
Print "Total number of field types: "&FieldTypes.Count
FieldTypes.Reset()
While FieldTypes.HasMoreElements()
Set FieldType=FieldTypes.Next()
Print FieldType.Name
Wend
Gets the next NWFieldType object.
object.Next()
None.
NWFieldType.
This example gets the next Field Type object in the collection.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set FieldTypes = nwdir.FieldTypes
Print "Total number of field types: "&FieldTypes.Count
FieldTypes.Reset()
While FieldTypes.HasMoreElements()
Set FieldType=FieldTypes.Next()
Print FieldType.Name
Wend
Determines whether or not any more NWFieldType objects exist in the collection based on the specified path.
object.HasMoreElements()
None.
Boolean.
Returns TRUE, if the collection contains some more NWFieldType objects.
This example checks whether there any more Field Type object in the collection.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set FieldTypes = nwdir.FieldTypes
Print "Total number of field types: "&FieldTypes.Count
FieldTypes.Reset()
While FieldTypes.HasMoreElements()
Set FieldType=FieldTypes.Next()
Print FieldType.Name
Wend
Returns the NWFieldType object for the specified index.
object.Element(
Index As Variant)
Index can be either numeric or string. String index represents the name of NWFieldType object.
NWFieldType.
This example gets the specified Field Type object in the collection; here, the Surname.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set FieldTypes = nwdir.FieldTypes
Print "Total number of field types: "&FieldTypes.Count
FieldTypes.Reset()
While FieldTypes.HasMoreElements()
Set FieldType=FieldTypes.Next()
Print FieldType.Name
Wend
’Display information about the field type "Surname"
Set SurnameField = FieldTypes.Element ("Surname")
Print SurnameField.SyntaxName
Returns the NWFieldType object for the specified index.
object.Item(
Index As Variant)
Index can be either numeric or string. String index represents the name of NWFieldType object.
NWFieldType.
This example gets the specified Field Type object in the collection; here, the Surname.
Set nwdir=CreateObject("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set FieldTypes = nwdir.FieldTypes
Print "Total number of field types: "&FieldTypes.Count
FieldTypes.Reset()
While FieldTypes.HasMoreElements()
Set FieldType=FieldType.Next()
Print FieldType.Name
Wend
’Display information about the field type "Surname"
Set SurnameField = FieldTypes.Item ("Surname")
Print SurnameField.SyntaxName
Creates a new field in the NDS Schema.
object.AddElement(
FieldName As String),
(SyntaxType As Integer)
Name of the desired field.
The NDS syntax type.
NWFieldType.
This example shows how to add a field into the NDS Schema.
Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login ("user", "password")
’Create object or attribute for relating the schema and the
create the schema
’ Build required parameters
MandatoryFields = Array("CN")
ContainmentLayouts = Array("Organization", "Organizational
Unit")
NamingFields = Array("CN")
LayoutName = "NSN Layout"
’ Create a new Layout
nwdir.Layouts.Add (LayoutName, "Top", MandatoryFields,
ContainmentLayouts, NamingFields)
If (Err.Number = 0) Then
Print "New Layout Created Succesfully"
Else
Print "Failed to Create New Layout"
End If
’Create a new field type
newFieldTypeName = "NSN FieldType"
Set fieldtypes = nwdir.fieldtypes
fieldtypes.AddElement(newFieldTypeName, SYN_CI_STRING)
’Add new field type into the 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
Creates a new field in the NDS Schema.
object.Add(
FieldName As String),
(SyntaxType As Integer)
Name of the desired field.
Returns the NDS syntax type.
NWFieldType.
This example shows how to add a field into the NDS Schema.
Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login ("user", "password")
’Create object or attribute for relating the schema
’ Build required parameters
MandatoryFields = Array("CN")
ContainmentLayouts = Array("Organization", "Organizational
Unit")
NamingFields = Array("CN")
LayoutName = "NSN Layout"
’Create a new Layout
nwdir.Layouts.Add (LayoutName, "Top", MandatoryFields,
ContainmentLayouts, NamingFields)
If (Err.Number = 0) Then
Print "New Layout Created Succesfully"
Else
Print "Failed to Create New Layout"
End If
’Create a new field type
newFieldTypeName = "NSN FieldType"
Set fieldtypes = nwdir.Fieldtypes
fieldtypes.AddElement(newFieldTypeName, SYN_CI_STRING)
’Add new field type into the 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
Removes a FieldType from the NDS Schema.
object.RemoveElement(
FieldName As String)
Name of the desired field to be removed.
Boolean.
This example shows how to remove a field from the NDS Schema.
Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login ("username", "password")
’Delete the object or attribute associated with the schema and
then delete the schema
Set Layouts = nwdir.Layouts()
If Layouts.RemoveElement("NSN Layout") Then
Print "Successfully removed the Layout"
Else
Print "Failed to remove the Layout"
End If
If (Nwdir.fieldtypes.Remove("NSN Fieldtype")) Then
Print "Successfully removed the fieldtype"
Else
Print "Failed to remove the fieldtype"
End If
Removes the field type from the NDS Schema.
object.Remove(
FieldName As String)
Name of the desired field to be removed.
Boolean.
This example shows how to remove a field from the NDS Schema.
Set nwdir = CreateObject("UCX:NWDIR")
nwdir.Login ("Username", "password")
’Delete the object or attribute associated with the schema and
then delete the schema
Set Layouts = nwdir.Layouts()
If Layouts.Remove("NSN Layout") Then
Print "Successfully removed the Layout"
Else
Print "Failed to remove the Layout"
End If
If (nwdir.Fieldtypes.Remove("NSN Fieldtype")) Then
Print "Successfully removed the fieldtype"
Else
Print "Failed to remove the fieldtype"
End If