Highlighted
shekarls Absent Member.
Absent Member.
294 views

Get last value from user defined varchar field

HI All,

           I have a user defined varchar field  'TS_USER_01'. This field usually contains numbers. 

How do i write a logic to get the last value or the largest value from this field.

 

For example - If TS_USER_01 has series of values from 1 to 10, then i want the output to be printed as 10.

How do i achieve this logic in script Editor under Test Plan.

0 Likes
3 Replies
ameyjo Outstanding Contributor.
Outstanding Contributor.

Re: Get last value from user defined varchar field

Hi

 

This is a small sample , replace the BG_BUG_ID and BUG  by the field , Table you need in.

 

Sub Bug_MoveTo


set td = TDConnection
set com = td.command
com.CommandText = "select max( BG_BUG_ID) from BUG "
set rec = com.Execute
msgbox  rec.FieldValue(0)
set com = nothing
set rec = nothing
set td = nothing

 

End Sub

 

Regards

"HP Support
If you find this or any post resolves your issue, please be sure to mark it as an accepted solution"
0 Likes
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: Get last value from user defined varchar field

Do you mean each field will contain a series of numbers? In that case you could use the VBScript Split function to get the individual numbers.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
nr.mohanreddy Absent Member.
Absent Member.

Re: Get last value from user defined varchar field

Is it possilbe to ge the value without extraacting the data from SQL query

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.