shekarls Absent Member.
Absent Member.
429 views

Assign an output of DB query to a custom defined field in QC 11

Jump to solution

HI All,

             I have the below logic to get the value from QC DB, I am printing the value and it looks fine, but i am not able to assign the value to the user defined field....please help me here

 

Sub TestPlan_Test_Autoid

set td = TDConnection

set com = td.command
com.CommandText = "select max(convert(int, TS_USER_07)) from TEST"
set rec = com.Execute
msgbox rec.FieldValue(0)
newValue = rec.FieldValue(0) + 1


msgbox newValue              ' I AM ABLE TO GET CORRECT VALUE TILL THIS POINT


Test_Fields("TS_USER_07").Value = newValue               'THIS STEP DOESNT WORK..... I am hoping variable newValue's value will be assigned to field "TS_USER_07"


Test_Fields("TS_USER_07").IsReadOnly = true
set com = nothing
' set rec = nothing
set td = nothing

End IF


End Sub

 

When i print - "msgbox newValue"  I am getting the exact value what i expected, but when i am trying to assign the same value to a field "Test_Fields("TS_USER_07").Value = newValue", then its coming as blank.

 

Tags (2)
0 Likes
1 Solution

Accepted Solutions
Highlighted
shekarls Absent Member.
Absent Member.

Re: Assign an output of DB query to a custom defined field in QC 11

Jump to solution

Thanks for your inputs,

Got it working just by Casting it to String value....

Test_Fields("TS_USER_07").Value =  CStr(newValue)

 

 

 

0 Likes
2 Replies
Absent Member.. Pradeep0905 Absent Member..
Absent Member..

Re: Assign an output of DB query to a custom defined field in QC 11

Jump to solution
In your query you are trying to convert the value to INTEGER. If the field is configured as Text in DB, then you cannot store the integer value in a Text field. Try casting to string in this scenario.
0 Likes
Highlighted
shekarls Absent Member.
Absent Member.

Re: Assign an output of DB query to a custom defined field in QC 11

Jump to solution

Thanks for your inputs,

Got it working just by Casting it to String value....

Test_Fields("TS_USER_07").Value =  CStr(newValue)

 

 

 

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.