How to convert Rational ClearQuest User Full Name into Title Case

Technote (FAQ)


Question

How do you convert IBM Rational ClearQuest User Full Names into Title case for all ClearQuest users?

Cause

Conversion to Title Case is required to achieve a good readability of user names while dealing with the fields like "Assignee" or "Submitter" in a ClearQuest Record. This will also help to maintain a common format or nomenclature of the ClearQuest User Names in the repository.

Answer

The following Perl Script uses ClearQuest APIs can be written and run on a Windows host.

Notes:

  • ClearQuest Native Client must be installed on the host
  • First run this script in a test environment.
  • Make this line as a comment "$userObj->SetFullName("@fullname");" and re-direct the output to a text file to verify it is working properly. Once verified, you can use "SetFullName" function to upload changes into the IBM Rational ClearQuest User Admin tool.

Procedure:
  1. Open command prompt

  2. Navgiate (cd) to the path where CQperl.exe is stored

    Default: C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe

  3. Save the below script text in a notepad with a .pl extension

  4. Run the following command:

    cqperl script.pl

  5. Login to IBM Rational ClearQuest User Administrator tool to verify the case conversion.

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.


*********************************
# Use of the Script-
# This script converts ClearQuest User's Full Name to Title Case.
# There are few examples-
##################################################################
# User Name Current    #    Will be converted to
##################################################################

# john smith           #    John Smith
# ponsot, eric         #    Ponsot, Eric

# simon, jean-yves     #    Simon, Jean-yves
#################################################################

# Note -
# Ensure you modify the below script as per your requirements and existing full name nomenclature.

# Ensure you have the correct path of CQperl.exe mentioned here
#!C:\Program Files\IBM\RationalSDLC\ClearQuest\CQperl.exe

# Providing "admin" credentials to login to the schema
# Below values are for example
my $dbset = "7.0.0";
my $adminUser = "admin";
my $adminPasswd = "adminpassword";

use CQPerlExt;
my @fullname;

#Create a Rational ClearQuest admin session
$adminSession= CQAdminSession::Build();

#Logon as admin
$adminSession->Logon( "$adminUser", "$adminPasswd", "$dbset" );

#Get the list of users in the repository.
$userList = $adminSession->GetUsers();

#Get the number of users
$numUsers = $userList->Count();

#Iterate through the users
for ( $x=0; $x<$numUsers; $x++ )
{

#Get the specified item in the collection of users
$userObj = $userList->Item( $x );

# Get the user's full name
$username = $userObj->GetFullName();

# Spliting the User's Full name based on a white space
# This should be modified as per your current nomenclature of the Users full name
my @values = split(' ',$username);

#Iterate through the full name to convert into Title case
foreach my $val (@values)
{

#Converting the word into a LowerCase
$lcall = lc($val);

#Changing the first letter to UpperCase
$ucfirst = ucfirst($lcall);

# Pushing the results to an array
push (@fullname, "$ucfirst");
}

# Array @fullname now contains the User's full name into Title Case
# Set the user's full name which is in Title case now
$userObj->SetFullName("@fullname");

# Empty the array, the same array should be used for next user in the loop
 @fullname = "";

}

# Unbuild the Admin Session
 CQAdminSession::Unbuild($adminSession);
 ********************************************

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational ClearQuest
API

Software version:

7.1.2, 7.1.2.3

Operating system(s):

Windows

Reference #:

1639467

Modified date:

2013-06-27

Translate my page

Machine Translation

Content navigation