How to find all the Defects which have 1-Critical severity and still in Submitted state using Rational ClearQuest APIs and SQL query

Technote (FAQ)


Question

How do you find all the Defects which have "1-Critical" severity and still in "Submitted" state using IBM Rational ClearQuest APIs and SQL query?

Cause

You need to get an instant and brief report on the Defects which have 1-Critical severity and still in Submitted state without logging into IBM Rational ClearQuest Client.

Answer

The Perl Script below uses the ClearQuest API and can be run on Windows.

Note: The ClearQuest Native Client must be installed on this machine.

This script iterates through all the ClearQuest Defects to find all the Defects which have 1-Critical severity and still in Submitted state. This script will prints Defect ID, State and Severity of the Defect.

Procedure:

  1. Navigate to the location where CQperl.exe is installed.

    By default: C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe

  2. Save the following Perl script text to notepad and save with a .pl extension.

    Disclaimer

    All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


    ****************************
    #!C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe
    # Make sure you have correct path for CQperl.exe

    use CQPerlExt;

    # Create a Rational ClearQuest admin session
    my $sessionObj = CQSession::Build();

    # Logon as admin
    # Provide correct values for admin password, User Database, and Schema Repository name
    $sessionObj->UserLogon("admin", "<adminPassword>", "<UserDataBase>", "<SchemaRepository>");

    my $sqlstring = "select distinct T1.dbid,T1.id,T2.name,T1.severity from Defect T1,statedef T2 where T1.state = T2.id and (T1.dbid <> 0 and ((T2.name = 'Submitted' and T1.severity = '1-Critical'))) order by T1.id ASC";
    my $ResultSet = $sessionObj-> BuildSQLQuery($sqlstring);

    $ResultSet->EnableRecordCount();
    $ResultSet->Execute();
    $recordCount = $ResultSet->GetRecordCount();

    print "Total number of defects in Submitted state with severity as 1-Critical are - $recordCount\n";
    for ($i=0;$i<$recordCount;$i++) {
    $status = $ResultSet->MoveNext();

    $ClearQuestID[$i]= $ResultSet->GetColumnValue(2);
    $State[$i] = $ResultSet->GetColumnValue(3);
    $Severity[$i] = $ResultSet->GetColumnValue(4);

    print "ID-$ClearQuestID[$i]  *** State-$State[$i]  *** Severity-$Severity[$i]\n";
    }
    #Unbuild the Admin session
    CQPerlExt::CQSession_Unbuild($sessionObj);
    *******************************

  3. Run the following command

    cqperl <filename.pl>

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational ClearQuest
API

Software version:

7.1.2.9

Operating system(s):

Windows

Reference #:

1653184

Modified date:

2013-10-16

Translate my page

Machine Translation

Content navigation