Micro Focus QTP (UFT) Forums
Get parameters of action - 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: Get parameters of action (/Thread-Get-parameters-of-action)



Get parameters of action - idolast - 07-02-2008

Hi again,

In my test, I'd like to parameterize my actions using action-parameters or external excel-files.
The excel-files contain testdata, that is imported into the local datatable of an action. I have created a vbscript function to import this data. This function is called from within the action.
But there should also be the possibility to pass data into an action, using action-parameters. However, to be most flexible, I thought it would be best to insert the data, passed in by parameters into the local datatable. So the action will not use the data from the parameters directly, but from the local datatable (which is filled either by an external Excel-file, or data passed in by parameters).

This works, if I do the filling of the local datatable manually. But it would be better to create a vbscript-function, which I could call from any action, which will load either the given excel-file or the parameters into the local datatable.

But in order to create such a function, I have to find out all the parameters. Is there a possibility to get the parameters (best by iterating through all parameters?).

At the moment I fill my local datatable with parameter-data like this:
Code:
DataTable("name1", dtLocalSheet) = parameter("name1")
DataTable("name2", dtLocalSheet) = parameter("name2")

As you can see, the datatable-columns have the same names as the parameters. If there was a way to somehow iterate through the parameters and insert the value of the parameter into the datatable-column with the same name, it would be great.

I have something like the following code in my mind:
Code:
Dim iterator
For iterator = 1 To Parameters.Count Step 1
  Datatable(Parameters(iterator).Name, dtLocalSheet) = Parameters(iterator).Value
Next

Is there any possibility to do something like that?