GetValueAsList
Description
Returns
a list of string values for the field associated with FieldInfo. This
is useful for fields that contain more than one value, including MULTILINE_STRING
field
types and parent/child controls for reference list types (REFERENCE_LIST
).
It is legal to use this method for a scalar field (that is, one that contains a single value). When used on a scalar field, this method returns only one element in the Array (unless the field is empty in which case an Empty Variant is returned).
To determine if a field can contain multiple values,
call the GetType
method
on the corresponding FieldInfo
object. If the type
of the field is REFERENCE_LIST
, ATTACHMENT_LIST
,
or JOURNAL
, the field can contain multiple values.
ATTACHMENT_LIST
or JOURNAL
cannot
be modified programmatically.Syntax
VBScript
fieldInfo.GetValueAsList
Perl
$fieldInfo->GetValueAsList
();
- Identifier
- Description
- fieldInfo
- A FieldInfo object, which contains information about one field of a user data record.
- Return value
- For Visual Basic, a Variant Array is returned.
The Variant contains the list of values, separated by vbLF (for scalar
fields, returns a 1-element Variant Array). If the field contains
no values, this method returns an Empty Variant.
For Perl, a reference to an array of strings containing the values in the list.
Examples
VBScript
MyList = MyField.GetValueAsList
if not IsEmpty (MyList) then
for each listItem in MyList
'...
next
end if
' You can separate the single variant that is returned into an array of
' string list elements by using the Split function:
av = GetFieldValue("multiline_string_field").GetValueAsList
if not IsEmpty(av) then
array = Split(Cstr(av(0)),vbLF)
u = UBound(array)
for i = 0 to u
' ...
next
end if
Perl
Dim MyList_array
MyList = MyField(fieldname).GetValueAsList
if not IsEmpty (MyList) then
MyList_array = Split(CSTR(MyList(0)),vbLF)
for each listItem in MyList_array
' ...
next
end if