Micro Focus QTP (UFT) Forums

Full Version: Passing Values from ReusableAction To mainscript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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
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.