Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create a random number starting with an alphabet
#1
Solved: 10 Years, 3 Months, 4 Weeks ago
Hi,
Could any one help me to create a random number starting with alphabet like A123456,

Regards.
Reply
#2
Solved: 10 Years, 3 Months, 4 Weeks ago
Hi,

does the alpahbet remain consant or it is random as the numbers?
Reply
#3
Solved: 10 Years, 3 Months, 4 Weeks ago
Hi Ankesh,

Thanks for your time and reply to the post.
Alphabet will be changing as well. I would like to select from an array of 10 alphabets.

Regards.
Reply
#4
Solved: 10 Years, 3 Months, 4 Weeks ago
Hi QTPmate,

Its simple.You can do it in a couple of ways.I am just presenting the logic.

For alphabets you would be getting it from Array so no problem for that.

For numbers what you can do is , you can use vbscript "Time" function which would return 3:26:54 , which you can split using ":" as delimiter , get it in array , then append array(0) , array(1) , which would give you a random number.

Here is the code which you can change accordingly

Code:
str_randomno=Time
Dim aftersplitting
aftersplitting=split(str_randomno,":")
print aftersplitting(0)&aftersplitting(1)&left(aftersplitting(2),2)

Thanks,
Gangadhar
Reply
#5
Solved: 10 Years, 3 Months, 4 Weeks ago
Thanks for help Gangadhar appreciated.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Random Values from Drop-Down profqa 5 6,025 12-06-2013, 09:01 AM
Last Post: basanth27
  Creating Random String SomeIntern 0 5,082 08-21-2013, 09:10 PM
Last Post: SomeIntern
  Random Number generator and verification problem jinnah 4 10,416 09-28-2012, 04:03 AM
Last Post: jinnah
  How to choose a random no from list alwarselvam 0 3,173 12-24-2011, 08:28 AM
Last Post: alwarselvam
  Starting QTP as a Windows Service adi_sesha 2 4,458 10-06-2010, 03:01 PM
Last Post: Pallavii

Forum Jump:


Users browsing this thread: 3 Guest(s)