How to add a new value to an existing Dynamic List using Rational ClearQuest APIs

Technote (FAQ)


Question

How do you add a new value to an existing Dynamic List using IBM Rational ClearQuest APIs?

Cause

This is required to have a quick solution to add new values to an existing Dynamic list without logging into IBM Rational ClearQuest Native 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 needs two inputs - The name of the Dynamic List and the new value to be added to this list.

After adding the new value to the list, this script prints all the values of that particular Dynamic List to the command prompt.

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.


Procedure:
  1. Navigate to the location where CQperl.exe is installed.
    By default: C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe

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

  3. Run the script using the following command:
    cqperl <filename.pl>

Pearl Script


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

use CQPerlExt;
my $sessionObj = CQSession::Build();

$sessionObj->UserLogon("admin","<adminPassword>","<UserDataBase>","<SchemaRepository>");

# Provide the name of your Dynamic list, in this example dynamic list name is "Phase"

$listname = "Phase";

# Provide the name of the new value you want to see in this list
# in this example new value for the list is "Analysis"
$newvalue = "Analysis";

# Adding the new value
$sessionObj->AddListMember($listname, $newvalue);

# printing the dynmaic list values after add

$allvalues = $sessionObj->GetListMembers($listname);
foreach $value (@$allvalues)
{
print $value, "\n";
}
# The new value has been added to the dynamic list

*******************************

Rate this page:

(0 users)Average rating

Document information


More support for:

Rational ClearQuest
API

Software version:

7.1.2.7, 7.1.2.9, 8.0.0.4

Operating system(s):

Windows

Reference #:

1655161

Modified date:

2013-11-06

Translate my page

Machine Translation

Content navigation