Posts: 3
Threads: 2
Joined: Nov 2011
Reputation:
0
11-23-2011, 09:04 PM
Can you please help me in generating sequential Account numbers in VB script.
For example : First time when I run the code, it should diplay account number as WEB000, Next time when it runs, it should check for duplicate and create a new one like WEB001.
pLEASE HELP ME Its very urgent.
Posts: 257
Threads: 10
Joined: Oct 2011
Reputation:
2
11-24-2011, 05:08 PM
(This post was last modified: 11-24-2011, 05:10 PM by ravi.gajul.)
Could you please let us know as to where you want to check for the duplicate number? (Application/database,etc).However,
For generating a random number as required..
Please try this,
Result = "WEB"
For var_i = 1 to 3
Result = Result & RandomNumber(0,9)
Next
msgbox Result
Regards,
Ravi
Posts: 3
Threads: 2
Joined: Nov 2011
Reputation:
0
11-24-2011, 10:12 PM
---------------------------
Thanks Ravi for your reply.
I am checking in the application.
My code is as below:
First Account number (EG 3000016), I am taking from the datatable.
Next time, when it runs, I have added Suffix "1" at the last , also incremented the counter.
For checing the Duplicate, I will be getting error message in the application saying "aCCount number already exists". I created Text Checkpoint for this error. This code I have put in DO while loop. whenever it returns true, next time it will imcrement the account number with "1" and check for the above error. Comes out of the loop when it is false.
Please guide me, whether the above procedure is correct, since I am new to QTP.
Posts: 257
Threads: 10
Joined: Oct 2011
Reputation:
2
11-25-2011, 09:50 AM
Well Ganesan try and see if you could get along.
Please post your code if you get stuck with any issue.