BlueCielo Meridian Enterprise 2012 VBScript API Reference | BlueCielo ECM Solutions

You are here: Understanding the Meridian object model > About the Table object > The Table object methods > GetValues method

GetValues method

Returns a variant array containing values from the current Table object. If the query does not match any values, the method returns an empty variant.

Syntax
GetValues([MatchColumns], [MatchValues], [OutColumns], [Distinct], [OrderBy], [FieldsInfo]) As Variant
Parameters
Name Description

MatchColumns

Optional array of column names to match in the table.

MatchValues

Optional array of column values to match in the table. The index of each value should match the index of its corresponding column in MatchColumns.

OutColumns

Optional array of column names to return in the result.

Distinct

If True, returns only the unique values. Optional.

OrderBy

Optional array of column names with which to sort the returned values.

FieldsInfo

Optional variant array to contain information about the returned columns. The information includes:

FieldsInfo(0) = Name of the column in the recordset (AS_CI_NAME)

FieldsInfo(1) = Data type (AS_CI_SIZE)

FieldsInfo(2) = Size (AS_CI_TYPE)

FieldsInfo(3) = Column attributes (AS_CI_ATTR)

Note    For the values of possible data types, see DataTypeEnum in MSDN. For the values of possible column attributes, see FieldAttributeEnum in MSDN.

Remarks

The GetValues method executes an SQL query with the specified parameters. For example, the following VBScript statement:

Vault.Table("Employees").GetValues(Array("Role","Department"), _
    Array("Manager","Engineering"), _
    Array("FirstName","LastName"), _
    False, "LastName")

Translates into the following SQL query:

SELECT FirstName, LastName FROM Employees WHERE Role='Manager' AND Department='Engineering' ORDER BY LastName

Note    The returned values array will hold the property values in the second dimension of the array, not the first dimension as might be expected.

If the FieldsInfo parameter is specified, that array contains information about the returned value array. This can be useful if you want a generic function that can operate with the results of different queries regardless the output columns and the order in which order they were requested. Moreover, using FieldsInfo, you can process results from different tables (or queries to external data sources) without specific knowledge of the column names, which may be named differently in different tables but have the same purpose in the context of your processing.

The following example functions demonstrate the use of FieldsInfo.

' Helper function that finds the index of a ShareName column in the results table.
Function FindShareNameIndex(fi)
  FindShareNameIndex = -1
  If IsArray(fi) Then
    For i = 0 To UBound(fi,1)
      If fi(0,i) = "ShareName" And fi(1,i) = 202 Then
        FindShareNameIndex = i
        Exit Function
      End If
    Next
  End If
End Function
Function TestFieldsInfo()
  Dim fi
  Dim res
  res = Vault.Table("GCFShares").GetValues(,,,,,fi)
  If IsArray(fi) Then
    Dim sni
    sni = FindShareNameIndex(fi)
    TestFieldsInfo = ""
    For j = 0 To UBound(res,2)
      TestFieldsInfo = TestFieldsInfo & res(sni,j) & ";"
    Next
  Else
    TestFieldsInfo = fi
  End If
End Function

Related concepts

About the Table object


Copyright © 2000-2012 BlueCielo ECM Solutions

www.bluecieloecm.com