Running a query against more than one record type
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:
- Change requests includes defects, enhancement requests, and documentation requests
- Work orders includes software fixes and hardware fixes
- Issues includes porting, features, and problem incidents
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:
- The schema has one record type family, TestFamily
- TestFamily contains two record types (for example, Defect and Enhancement Request)
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;
}