UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Absent Member.
Absent Member.
25879 views

How to get/know the "field names" in QC?

Hi,

In QC users can see the Label of the fileds but I would like to know all the 'Field Names and Labels". Do we have any way to know the field names and labels with out go to customization and No database access.

Thanks,
Punati.
0 Likes
15 Replies
Absent Member.
Absent Member.

Hi,

I regret to think it is impossible to get this information without using the customization object.

Kind Regards.
0 Likes
Absent Member.
Absent Member.

Hi Peeters,

I heard as this is possible through the scripting but not sure... Just I would like to know is it possible or not? If yes how and script guidence...

Thanks,
Punati.
0 Likes
Absent Member.
Absent Member.

Perhaps following code can help you... It looks up the Label and stores it to a dictionary to speed up future querries.



Dim gFieldTableNameDICT: Set gFieldTableNameDICT = CreateObject("Scripting.Dictionary")
gFieldTableNameDICT.CompareMode = vbTextCompare
gFieldTableNameDICT.Item("RQ") = "REQ"
gFieldTableNameDICT.Item("CY") = "CYCLE"
gFieldTableNameDICT.Item("TS") = "TEST"
gFieldTableNameDICT.Item("TC") = "TESTCYCL"
gFieldTableNameDICT.Item("BG") = "BUG"
gFieldTableNameDICT.Item("RN") = "RUN"

Dim gFieldToLabelDICT: Set gFieldToLabelDICT = CreateObject("Scripting.Dictionary")
gFieldToLabelDICT.CompareMode = vbTextCompare

'===============================================================================
Function StrGetFieldLabelForField(strFieldName)
' If it doesn't exist yet in fieldlabel dict -> add to dict
If Not gFieldToLabelDICT.Exists(strFieldName) Then
Dim custFields: Set custFields = TDConnection.Customization.Fields
Dim tableName: tableName = StrGetTableNameForField(strFieldName)

If custFields.FieldExists(tableName, strFieldName) Then
gFieldToLabelDICT.Item(strFieldName) = custFields.Field(tableName, strFieldName).UserLabel
End If
End If

StrGetFieldLabelForField = gFieldToLabelDICT.Item(strFieldName)
End Function

'===============================================================================
Function StrGetTableNameForField(strFieldName)
Dim code: code = Split(strFieldName, "_")(0)
Dim result: result = gFieldTableNameDICT.Item(code)
StrGetTableNameForField = result
End Function



Kind Regards.
Absent Member.
Absent Member.

Hi Peeters,

Let me check...

Thanks for your response...
0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

The similar example for fields you can find in OTA API manual with name "Get list of fields in a table" that is what you exactly need.
Or you can use Excel Report with the folowing sql query:
---
SELECT SF_COLUMN_NAME, SF_USER_LABEL FROM SYSTEM_FIELD where SF_TABLE_NAME='BUG' order by SF_COLUMN_NAME
---
You can find the db structure in "HP Quality Center Database Reference" manual.
Admiral Admiral
Admiral

Hello Punati,

You can try this.Go to dashboard.create a new excel report --click on configure and click on query builder which will open a new editor and onto the right side you will see the tables and the field names for the particular project.Pick the option user and sql entities from entities view.Then based on the module you are looking you can expand the table and see the field names.

Hope this helps,

Regards,
Venkat
Venkat
0 Likes
Absent Member.
Absent Member.

am unable to get the field property of test object in my code

please help

i am using HPQC version 10.0

0 Likes
Fleet Admiral
Fleet Admiral

Hi,

 

I think Vladimir give you the solution and it is quite easy.

 

Ciao, Massimo.

0 Likes
Absent Member.
Absent Member.

i din get that solution

 

i am adding a new test case through OTA in HPQC .

i need to assign values to the fields of test ie name,status,designer,exec date etc as entered by the user

the values for the properties of hpqc (like name,status,exec date etc) can be easily assigend

but in order to assign values to customised fileds .... i am unable to get the option test.FIELD in my code by which i can assign vales to customised properties like this

test.field["TS_USER01"]= "jack" ;

 

am working in C# .net

 

 

0 Likes
Absent Member.. Absent Member..
Absent Member..

Use the TDConnection object's Fields property to get a list of all fields for the TEST object.

Once you have the list of all fields, you can look at the Properties for each Field item in the list. If you know the visible label for the field, then you can look at the UserLabel property to find the Field item from the list that matches. Once you've found the specific Field item from the list, then you can look at that item's Name property to get the name to use with the Test.Field () method.

The OTA API documentation has sample code for doing this.
[If this post solves or helps solve your issue, mark the thread as solved and give KUDOS to the author for their assistance.]

(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
Absent Member.
Absent Member.

thanks for quick reply !

 

i agree with the solution but my prob is

am unable to get test.field method in my code

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.