Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Increment Number
#1
Not Solved
I am kicking the tires of QTP for the first time and recorded a relativley small action.

I have a SSN that I want to increment after every run. How can I increment just the last number on each run?


Code:
Browser("Create New Application").Page("Create New Application").Link("Create New Application").Click
Browser("Create New Application").Page("Create New Application_2").WebEdit("lastName").Set "Aipperspach"
Browser("Create New Application").Page("Create New Application_2").WebEdit("taxId").Set "156-15-1561"
Browser("Create New Application").Page("Create New Application_2").WebEdit("reEnterTaxId").Set "[color=#FFD700]111-11-1111[/color]___-__-____"
Browser("Create New Application").Page("Create New Application_2").WebButton("Next »").Click
Browser("Create New Application").Page("Create New Application_2").WebCheckBox("agentApplicationForm:distribut").Set "ON"
Browser("Create New Application").Page("Create New Application_2").WebButton("Next »_2").Click
Browser("Create New Application").Page("Create New Application_2").WebButton("Submit Query").Click
Reply
#2
Not Solved
Hi,
We can increment all ur test SSN as given below.
Code:
SSN="123-12-1239"  ' old SSN
SSN = Cstr(CLng(Replace(SSN,"-",""))+1)
SSN = Left(SSN,3) & "-" & Mid(SSN,4,2) & "-" & Right(SSN,4)
msgbox SSN  ' prints new SSN
Reply
#3
Not Solved
I don't think you can get any information of any variable in previous run.
If you are re running and expecting an incremented value used in previous run, you may be in wrong path of working on your scenario.

You can iterate same code as many times as you are actually wanting to run the script and in every iteration just increment a variable value

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Count the number of 3 number appers between 0-3333 SaranKumarV 1 3,797 09-20-2010, 06:32 PM
Last Post: rdemers25

Forum Jump:


Users browsing this thread: 1 Guest(s)