Micro Focus QTP (UFT) Forums
Passing Values from ReusableAction To mainscript - 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: Passing Values from ReusableAction To mainscript (/Thread-Passing-Values-from-ReusableAction-To-mainscript)



Passing Values from ReusableAction To mainscript - bostonma - 03-24-2009

Hi,

I am using Reusable Action in Script where the Reusable action performs some checks and then have to pass the values to MainScript.
For this I am using Globaldatasheet as means of communication between ReusableAction and Main script.

DataTable.GlobalSheet.AddParameter "Disp", PrdName

the Above line works great if there is only one iteration. For the second iteration in dataTable it is unable to write "Disp" value in second row.
How can I do this?
Note: I have tried using environment variables but as I am new to that concept was not clear on that so I am using Globaldatasheet.
Please suggest.

Basically For each iteration in Main Sript, I want the Reusable Action's output to be written to Globalda


RE: Passing Values from ReusableAction To mainscript - bostonma - 03-25-2009

I have got the answer for this.

Code:
On error resume next
CheckForParam = DataTable("Display", dtGlobalSheet)

If err.number <> 0 Then
'Param does not exist and must be added
DataTable.GetSheet("Global").AddParameter "Display",PrdName
Else
'Param exists and should be updated
DataTable.Value("Display",dtGlobalSheet) = PrdName
End If



RE: Passing Values from ReusableAction To mainscript - Marc - 03-29-2009

A little more elegant is using Environment("ActionIteration") to determine if it's the first iteration and thus the parameter has to be added.

Of course you can also pass values between actions using the input- and output-parameters of an Action.