Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing array of classes to parameter of action
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hello,

Goal: From the qtp main starting file, initialize an array of classes, and pass that array as a parameter to a re-usable action via a parameter.

Problem: I am not able to pass an array of classes to my re-usable action.

I have the main startup file which we will reference as “application_main”.

I have a re-usable action which we will reference as “personal_action”

Inside application_main, we have a call to InvokeApplication, proceeded by a few other declarations.

I am able to initialize my array of classes fine (variable name: “myArray”). I proceed to pass that array as a parameter as follows in my application_main:

RunAction “personal_action”, oneIteration, customParam1, customParam2, myArray

On the personal_action page, I have the ability to edit the parameter properties via Edit->Action->Action Properties. I select the Parameters tab. In it, I am able to define the incoming parameters as:

String, Boolean, Date, Number, Password, Any

Since “array” is not available, I select “Any”.

Upon running, I am prompted with this:

Code:
The type you specified for the ‘myArray’ parameter in your RunAction statement does not match the type defined in the action.

The array is the third parameter being passed, and the third parameter type is “any”.

My Question: Why am I not able to pass an array to an action from the main startup file? Does anyone know of a way to do this?

Any help is appreciated. Thank you.
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,

I had used global dictionary to transfer the array between action

Use the below code for reference and implement it as per ur requirement

Code in Action1:
Code:
Code:
d=Array("London","Boston","Newyork","Sanfransisco")        
For i=0 to ubound(d)
   GlobalDictionary.Item("Name"&i)=d(i)            
Next

Code in Action2:
Code:
Code:
x=GlobalDictionary.items
   For j=0 to ubound(x)
     msgbox x(j)
  Next


Let me know in case of any help required.

Regards,
Sankalp
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Part of parameters missing when passing between actions skumar007 1 2,836 10-10-2014, 02:00 AM
Last Post: skumar007
  Action Parameter passing problem Qtpuser1 1 2,708 04-18-2014, 06:23 AM
Last Post: kgovadav
  How to convert a single dimension array to two dimensional array venkatesh9032 3 5,192 02-10-2014, 03:07 PM
Last Post: pranikgarg
  Getting run error passing a Frame into a user defined function!!! sepgs2004 1 2,702 10-14-2013, 06:37 PM
Last Post: anil2u
  Parameter bistritapcv 0 2,242 04-02-2013, 09:10 PM
Last Post: bistritapcv

Forum Jump:


Users browsing this thread: 1 Guest(s)