Micro Focus QTP (UFT) Forums
Save randomly generated string - 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: Save randomly generated string (/Thread-Save-randomly-generated-string)



Save randomly generated string - SomeIntern - 08-26-2013

Hello again,

I had a quick question, I wanted to know if there is a way I can save a randomly generated string or call that value again later in a test. I use the value to set a last name field, then I need that value so I can search for that last name later in the my test. Any help would be greatly appreciated.

Regards,
Erik


RE: Save randomly generated string - SomeIntern - 08-27-2013

Figured it out from link below.
Code:
Environment.Value("DocName")= GetRandom(8)
Browser("PROMPT").Page("PROMPT").WebEdit("tp_last_name").Set Environment.Value("DocName")

new action
Code:
Browser("PROMPT").Page("PROMPT").WebEdit("keywordsearch").Set Environment.Value("DocName")

https://www.learnqtp.com/all-about-environment-variables-in-qtp/