Running a query against more than one record type

IBM® Rational® ClearQuest® enables you to create a query that retrieves data from more than one record type. A Multitype query fetches data from all the records types that belong to a given record type family. Here are some possible examples of record type families:

To learn about record type families, look up record type families in the index of Administrating ClearQuest.

This code fragment from an external application assumes that:

VBScript

Dim qryDef ' a QueryDef object

Dim resultSet ' a Resultset object

Dim familyEntDef ' an EntityDef object

Dim families ' a Variant

Dim session ' a Session object

Dim i ' a String



' Insert code here to get the session object and log in to the database

families = session.GetEntityDefFamilyNames

If IsArray(families) Then

    Debug.Print UBound(families)

    For i = 0 To UBound(families)

         ' Do something with families(i)  

    Next i

    Set qryDef = session.BuildQuery(families(0))

    qryDef.BuildField ("Description")

    Set resultSet = session.BuildResultSet(qryDef)

End If 

Perl

# Insert code here to get the session object and log in to the database

$families = $session->GetEntityDefFamilyNames();

foreach $familyName in (@$families)  {

   print ($familyName);

}

if ($qryDef = $session->BuildQuery(@$families[0]))  {

   # do something;

} 

$qryDef->BuildField("Description");

$resultSet = $session->BuildResultSet($qryDef);

if ($resultSet->IsMultiType())   {

   # do something;

}

$familyEntDef = $session->GetEntityDefFamily(@$families[0]);

if ($familyEntDef->IsFamily())  {

   # do something;

} 

Feedback