GetFieldlist Method for LCField

This method retrieves a fieldlist from a field. The resulting fieldlist is a reference to the original inside the field. If the field doesn't contain an LCFieldlist as its value, an LCFAIL_INVALID_CONVERT error will occur.

An LCField object can contain a reference to an LCFieldList, allowing you to nest a fieldlist inside another fieldlist. This lets you manage information in memory that includes records that contain multi-valued information. An example of this is an order processing application where a single order ID is the key field for a table containing multiple line item entries per order. You can create a field list that contains the order key (and any other information that appears only once in the record) and a field that contains an LCFieldlist giving the order rows, which may have multiple occurrences.

sample LCFieldList order record image

The LC LSX does not contain any methods that support reading or writing complex records such as this in a single step, but this feature may be helpful in organizing your data and code.

Defined In

LCField

Syntax

Set newFieldList = lcField.GetFieldList (index)

Parameters

Parameter

Description

index

Long, >= 1. Index of the field data value to be retrieved.

Return Value

Value

Description

newFieldList

LCFieldList. The value of the retrieved data type.

Example

Option Public
Option Explicit
Uselsx "*lsxlc"  
Sub Initialize
  Dim Record As New LCFieldlist
  Dim SubRecord As New LCFieldlist
  Dim field As LCField
  ' start building FieldList
  Set field = Record.Append ("group", LCTYPE_INT)
  field.Value = 4200
  ' Build SubFieldList
  Set field = SubRecord.Append ("category", LCTYPE_TEXT)
  field.Value = "potato"
  Set field = SubRecord.Append ("description", LCTYPE_TEXT)
  field.Value = "russet"
  Set field = SubRecord.Append ("sku", LCTYPE_INT)
  field.Value = 4207
  ' return to building the FieldList
  Set field = Record.Append ("item", LCTYPE_FIELDLIST)
  ' now assign the SubRecord to the Record
  Call field.SetFieldList (1, SubRecord)
  Delete SubRecord
  Set SubRecord = field.getFieldList (1)
  Print "The first field of the field's fieldlist is " & SubRecord.Names(0)
End Sub

Example Output

The first field of the field's fieldlist is category.