Micro Focus QTP (UFT) Forums
QTP script for displaying sequential account numbers - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP script for displaying sequential account numbers (/Thread-QTP-script-for-displaying-sequential-account-numbers)



QTP script for displaying sequential account numbers - GanesanAnand - 11-23-2011

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.


RE: QTP script for displaying sequential account numbers - ravi.gajul - 11-24-2011

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


RE: QTP script for displaying sequential account numbers - GanesanAnand - 11-24-2011

---------------------------

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.


RE: QTP script for displaying sequential account numbers - ravi.gajul - 11-25-2011

Well Ganesan try and see if you could get along.
Please post your code if you get stuck with any issue.