Micro Focus QTP (UFT) Forums
Copy actual value or use RandomString generated before - 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: Copy actual value or use RandomString generated before (/Thread-Copy-actual-value-or-use-RandomString-generated-before)



Copy actual value or use RandomString generated before - mwietrzyk - 02-01-2012

Hi,

I would appreciate help with copy action or re-use of RandomString in another action. I need to copy actual displayed value or use RandomString I generated before in another action.


I have a code when I generate RandomString (see below)

Action 1
Code:
Str1=RandomString(15)
Browser("PROMPT").Page("PROMPT").WebEdit("vin").Set Str1
Str2=RandomString(6)
Browser("PROMPT").Page("PROMPT").WebEdit("regNo").Set Str2
Str3=RandomString(3)
Browser("PROMPT").Page("PROMPT_2").WebEdit("model").Set Str3

Browser("PROMPT").Page("PROMPT_2").WebEdit("make").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("buildYear").Set "2012"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineMake").Set "Volvo"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineModel").Set "V600"
Browser("PROMPT").Page("PROMPT_2").WebEdit("engineHorsePowerRange").Set "600"
Browser("PROMPT").Page("PROMPT_2").WebList("vehicleTypeStr").Select "Truck"
Browser("PROMPT").Page("PROMPT_2").WebButton("Save").Click
Browser("PROMPT").Page("PROMPT_3").WebElement("The maintenance plan is").Check CheckPoint("The maintenance plan is not created until you select Approve._2")

Action 2

In action two I want to repeat the first script from action 1 (just use the same string I generated before)

.Set Str1 does not help at all

Any suggestions?

Thx,
Matt


RE: Copy actual value or use RandomString generated before - basanth27 - 02-01-2012

You may want to read about environment variables. A transcript would be,

In Action 1:

Environment.Value("Str1") = RandomString(15)

In Action 2:

Msgbox Environment.Value("Str1")

Or

Learn about global variables.


RE: Copy actual value or use RandomString generated before - mwietrzyk - 02-02-2012

Thx