Getting Objects in a Collection - Teradata Meta Data Services

Teradata Meta Data Services Programmer Guide

Product
Teradata Meta Data Services
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
Product Category
Teradata Tools and Utilities

Getting Objects in a Collection

This section shows example code of reading objects in a collection.

'/////////////////////////////////////////////////////////////////////////////////
'
'   GetCollections
'
'////////////////////////////////////////////////////////////////////////////////
Sub GetCollections()
    Dim keyList As New MetaInfoKeyList
    Dim key As New MetaInfoKey
    Dim testList As MetaInfoList
    Dim info As MetaInfo
    
    DisplayHeadingLine "MetaActive::GetCollections"
    Set key = Nothing
    Set keyList = Nothing
    
    'get destination objects using the relationshipID   
    Set testList = Repository.GetCollections(DESTINATION, Class0Obj1, "", 
		RelID_Class0Class1)    
    Set testList = Nothing
    
    ' get destination objects via relationship GUID
    Set testList = Repository.GetCollections(DESTINATION, Class0Obj1, 
		RelGUID_Class0Class1, 0)
    Set testList = Nothing
    
    'get destination object(s) via name
    Set testList = Repository.GetCollections(DESTINATION, Class0Obj1, "", 
		RelID_Class0Class1, "Entry Six")    
    Set testList = Nothing   
    Set testList = Repository.GetCollections(DESTINATION, Class0Obj2, "", 
		RelID_Class0Class1, "Entry%")
   
    Exit Sub
End Sub
'///////////////////////////////////////////////////////////////////////////////
'
' GetCollectionsByProperty
'
'///////////////////////////////////////////////////////////////////////////////
Function GetCollectionsByProperty (name As String, _
                                value As Variant, _
                                ObjectID As Long, _
   relID As Long, _
                                relGUID As String) As Boolean
    
    Dim keyList As New MetaInfoKeyList
    Dim key As New MetaInfoKey
    Dim testList As MetaInfoList
    Dim filterList As New MetaFilterList
    Dim sortList As New MetaInfoKeyList
    Dim filter As New MetaFilter
    Dim val As Boolean
    
    filter.filter.name = name
    filter.filter.value = value
    filter.Logical = META_AND
    filter.operator = EQUAL
    filterList.Add filter
    
    Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID, 
		relID, "", filterList, sortList)
    
    Set filterList = Nothing
    filter.operator = LESS_THAN
    filterList.Add filter
        
    Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID, 
		relID, "", filterList, sortList)
        
    Set filterList = Nothing
    filter.operator = GREATER_THAN_OR_EQUAL
    filterList.Add filter
        
    Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID, 
		relID, "", filterList, sortList)
      
    ' now do two values separated by OR
    Set filterList = Nothing
    Set testList = Nothing
    filter.operator = LESS_THAN
    filter.Logical = META_OR
    filterList.Add filter
    filter.operator = GREATER_THAN
    filterList.Add filter
        
    Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID, 
		relID, "", filterList, sortList)
  
    Exit Function    
End Function