# Thread: How to generate a new 10-digit number

1. ## How to generate a new 10-digit number

I am trying to input a 10-digit number into an editable field. The test case requires that a new number be inputted for the system to accept the value into the editable field. I would like to how to insert a new value from the data table every time I run the script. Please advise

2. ## Re: How to generate a new 10-digit number

newNumber=RandomNumber.Value(1000000000, 9999999999)

3. ## Re: How to generate a new 10-digit number

Suchit,

I got the following error message:
Overflow: 'RandomNumber.Value'
Line (21): "newNumber=RandomNumber.Value(1000000000, 9999999999)".

Here is the Syntax that I used:

Dim newNumber

newNumber=RandomNumber.Value(3500000000, 9999999999)

SAPGuiSession("Session").SAPGuiWindow("Inspection Plan Create:").SAPGuiEdit("newNumber")

Let me know if I messed with the Syntax, please

4. ## Re: How to generate a new 10-digit number

From QTP Help file : Maximum allowable value is 2147483647

So you can do something like this
newNumber=RandomNumber.Value(350000000, 999999999)*10 + RandomNumber.Value(0, 9)

5. ## Re: How to generate a new 10-digit number

Print DotNetFactory.CreateInstance("System.DateTime").No w.ToString("MMddHHmmss")

6. ## Re: How to generate a new 10-digit number

You can also use below

<font class="small">Code:</font><hr /><pre>
txtRand = ""
For i = 1 to 10
txtRand = txtRand &amp; RandomNumber.Value(1,9)
Next
</pre><hr />

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.