Micro Focus QTP (UFT) Forums
input / ouput parameters - 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: input / ouput parameters (/Thread-input-ouput-parameters)



input / ouput parameters - jove1776 - 12-17-2010

Hi folks!

A quick question as parameters are confusing me.

I have a test that creates a file that I need to upload into the system I am working on. The file creation works and is no problem.

The basic outline of the test is as follows:
2 actions
Action 1 create file
Action 2 process file


Action 1
1. Create the file
2. set a variable with the name of the file

Action 2
1. get the name of the file (from action 1) and process this


So I need to somehow pass this name from the first action to the second action.

How do I do this? I did try using the following:

Going to the action properties of action 1 and setting an output parameter

name : filename - type string

And then going to the action 2 properties and setting the input parameter

name infile - type string


How do I accomplish this task do I need datatable for this or can it be done with variables?





RE: input / ouput parameters - manishbhalshankar - 12-17-2010

Hi Jove,

Save the file name in DataTable by using DataTable.GlobalSheet.AddParameter and then fetch it form Action 2.


RE: input / ouput parameters - jove1776 - 12-17-2010

Hi manish,

Sorry for the slow response I did manage to get the datatable populated with my value like you said.

Thanks!




RE: input / ouput parameters - sreekanth chilam - 12-17-2010

Hi jove1776,

You can use any one of the following to complete your task Smile
1. Environment Variables
2. Output values
3. Action Parameters
4. Dictionary Objects

Example:
Action1:
Code:
Filename_created="sample file which got created"
Environment("FileName")=Filename_created

Action2:
'Retrieve the name of the file using the above environment variable as shown below.

Code:
FileTobeProcessed=Environment("FileName")
' write the code for processing the file