Work with Lists

 

 

List Management is one of the most important concept in Quality Center. These are the arguments I will explain:

 

  • Lists Type
  • List Definition
  • Items and SubItems of a List
  • How they are stored in Quality Center (tab ALL_LISTS)
  • Link of a List to a Field - Project Entities
  • Link of a List to a Field - Script Editor
  • How to Add and Remove an Item to/from a List

 

______________________________________________________________________

 

1. Lists Type

 

There are 2 kinds of List for Quality Center:

  • User List
  • Data Lists

 

The User List is a kind of data you can associated to a Field. In this case Quality Center, automatically, will define the field as List of Users of the Project.

 

Data Lists are list of values.

 

 

2. List Definition

 

The definition of a list could do in 2 manners:

  • from Project Lists link (standard and suggested) from Customization
  • during the creation of a new list field (LookUpList and not User List)

 

The creation of the list from Project Lists link is the more logical and standard manner for this task:

 

 

 

 

As I said before it is possible to create a new list during the creation of a new LookupList field.

 

 

3. Items and SubItems of a List

 

As you can see the list above is call PROVA_MAX and it contains the items Item1, Item2, Item3 that are at the same level and below Item2 there is a SubItem call Item2_1.

 

User can select one of all of these value.

 

 

 

4. How they are stored in Quality Center (tab ALL_LISTS)

 

Lists are saved in the table ALL_LISTS and every item is rappresented by a logical path (the naming convention use in Quality Center is something like: 

AAAABAAABAAC). There is also the info about the father ID.

 

For the List of the pic above the record in the table refered to the PROVA_MAX list will have an ID (suppose 6) and as Father_ID 0. The items object Item1/2/3 will have their own ID (f.e. 7,8,9) and as Father_ID 6. The object Item2_1 will have its own ID (f.e. 10) and as Father_ID 8 (the Item2 ID).

 

The most important fields of the table are:

  • AL_ITEM_ID: The object ID
  • AL_FATHER_ID: The Father ID
  • AL_DESCRIPTION: The Name of the Object
  • AL_ABSOLUTE_PATH: internal QC path (they consist on alphabetic triplets as mentioned before)

 

 

5. Link of a List to a Field - Project Entities

 

If you don't associate a list to a field you cannot use it and it is not useful. So it's possible link a list, already exists or to define, to a field of LookupList Type through the Project Entities link:

 

 

 

 

 

In this case you need to set a new value for the label for the ST_USER_03 field, the type must be Lookup List and you need to choose a list from the existing lists or, through the "New List" button,  create a new one that will be linked to the field.

 

 

 

6. Link of a List to a Field - Script Editor

 

It's possibile also dynamically link  a list to a field using instruction into the code from the Script Editor. Let's see how.

 

Suppose to have an object (Req, Test, Defect, etc...) that has a Lookup List Field, and it could be link to 3 different lists depends on some internal logic coding. Obviusly the 3 lists must exists.

 

Obj rappresents an object (Req, Test, etc...) and DBField a field of type Lookup List defined as User Field (RQ/BG/TS_USER_01).

Suppose that these lists called: Lista1, Lista2, Lista3.

The logic is this one. If strVal = 1 then it must be set Lista1 and so on.

 

The Code will be something like:

 

Select Case strVar

          Case 1: Obj_Fields.Field("DBField").List = Lists("Lista1")

          Case 2: Obj_Fields.Field("DBField").List = Lists("Lista2")

          Case 3: Obj_Fields.Field("DBField").List = Lists("Lista3")

End Select

 

 

 

7. How to Add and Remove Item to/from a List

 

It is possible to remove and add item of a list from Project Lists link in Customization or through Code. In this last case the steps are:

  • Retrieve the List object to work on
  • Access to the Root element of the List (this action is the most important)
  • Add/Remove Elements passing the name of the object

 

1. Retrieve the List object to work on

 

set MyList = TDConnection.Customization.Lists.List("ListName")

 

2. Access to the Root Element that allow userto work the List

set theRoot = MyList.RootNode

 

3. Add/Remove Element

theRoot.AddChild "ItemX"  (use the method .RemoveChild to remove the element)

theRoot.AddChild "ItemY"

 

TDConnection.Customization.Commit

 

set theRoot = Nothing

set MyList = Nothing

 

______________________________________________________________________