Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to continue after running a function
#1
Solved: 11 Years, 4 Months, 1 Week ago
Hi everybody,

As I am just a Beginner in QTP. I got a question here.
I have found a function and the function run properly.
However, I don't know how to set the Qtp to continues with the scripts when "intRows = 1". If "intRows" doesn't equal to 1, then an error should pop-put.
Can anyone help ?

Here is the function I found.
Function GetSiebListRows( byRef oSiebApplet, pValUINameSiebList )
'—————————————————————————————————————————
Code:
'SiebList is a list object in a Siebel test automation environment

  Dim vCounter
  If InStr(1, pValUINameSiebList, "uiname") <> 0 Then
    pValUINameSiebList = Trim(Split(pValUINameSiebList, ":=")(1))
  End If

  'From QTP Ref:
  '_ The RecordCounter indicates the visible text of the record counter
  '_ string (for example: 1 - 7 or 7+)
  vCounter = oSiebApplet.RecordCounter

  Do
    If InStr(1, vCounter, "+") <> 0 Then
      oSiebApplet.SiebList("uiname:=" & pValUINameSiebList).NextRowSet
      vCounter = oSiebApplet.RecordCounter
    Else
      vCounter = oSiebApplet.RecordCounter
      Exit Do
    End If
  Loop

  If InStr(1, vCounter, "of") <> 0 Then
    vCounter = CInt(Trim(Split(CStr(vCounter), "of")(1)))
  End If

  GetSiebListRows = vCounter
End Function


Dim oSiebApplet, intRows
Set oSiebApplet = SiebApplication("Siebel Energy (CMS DR)").SiebScreen("Agreement").SiebView("Agreement Charges").SiebApplet("Invoices")
intRows = GetSiebListRows( oSiebApplet, "uiname:=List" )
Reply
#2
Solved: 11 Years, 4 Months, 1 Week ago
In which part of the code you are having difficulty, as per your explanation I understood that your function GetSiebListRows is working fine and you are getting the output in intRows. No you want to check some condition and proceed further. right? Correct me I am wrong.

you can simply use an IF..Then..Else
Code:
IF intRows <> 1 then[hr]
you can simply use an IF..Then..Else
[code]
IF intRows <> 1 then
msgbox "Error"
else
Your Further statements..
end if

Reply
#3
Solved: 11 Years, 4 Months, 1 Week ago
this is helpful ,thanks
Jody
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 6,131 06-26-2015, 12:31 AM
Last Post: babu123
  Test run cannot continue oak 1 4,860 11-03-2014, 10:54 AM
Last Post: vinod123
  How to continue test after it fails a step sqadri 4 4,574 01-20-2012, 10:02 PM
Last Post: sqadri

Forum Jump:


Users browsing this thread: 1 Guest(s)