Micro Focus QTP (UFT) Forums
Can v save random numbers in a table - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Can v save random numbers in a table (/Thread-Can-v-save-random-numbers-in-a-table)



Can v save random numbers in a table - srivania - 09-25-2008

Hi,

Can any one please tell me, how to save the random numbers in a runtime data table.

Is it possible to do so??

My sample program is,
Code:
For i = 1 to 10
    var = RandomNumber(0,50)
    msgbox var,,RandomNumbers_are
Next

in a message box a random number will be displayed.

Randomnumbers can be viewed in results window, if the action is reusable.
My doubt is, when action is not reusable one, how to save those values? if so, how to do that....

Thanks in Advance.
Srivani


RE: Can v save random numbers in a table - Ankur - 09-29-2008

I assume random_no is the column name...so here is the code

Code:
For i = 1 to 10
var = RandomNumber(0,50)
[b]Datatable.Value("random_no") = var[/b]
msgbox var,,RandomNumbers_are
Next