Quantcast
Channel: Quality Center / ALM Practitioners Forum topics
Viewing all articles
Browse latest Browse all 5491

QC 11 - Getting Max Value from a field and using it in script Editor

$
0
0

HI All,

             I want to write a logic to get a Maximum value from the User defined field and always add 1 to it.

I Tried something like below, it doesnt work, let me know if there is any better way to do it without querying database to get the Maximum value.

 

TS_USER_07 is a user defined field under TEST PLAN Tab . It contains numbers, so i  have to retrieve the max number from this field.

 

Based on input from other threads, i tried putting something like below..

 

Sub getLatestValue
On Error Resume Next


dim com

dim rec
dim td

set td = TDConnection
set com = td.Command

 

'Trying to get Maxium Value from Database view Column - is this the way to do it.

 

com.CommandText = "select MAX(TS_USER_07) from dbo.V_Regression"    

 

set rec = com.Execute
rec.First

 

 ' To Add 1 to the Max value

newValue = rec.First + 1 

 

set com = nothing
set rec = nothing
set td = nothing

 

End Sub

 

Corrections and new suggestions are welcome.....


Viewing all articles
Browse latest Browse all 5491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>