Micro Focus QTP (UFT) Forums
help with passing value to second 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: help with passing value to second action (/Thread-help-with-passing-value-to-second-action)



help with passing value to second action - jove1776 - 04-19-2011

Have an issue in passing a value from one action to the next.

I looked at this all morning but couldnt see what I was doing wrong especially since it working yesterday.

OK a summary of the 2 actions

Action 1 Properties
------------------
output parameters = pOrderNr

Action 1 Call Properties
----------------------
output parameters = pOrderNr


Action2 Properties
-----------------
input parameters = pOrderNr

Action2 Call Properties
---------------------
Input parameters = pOrderNr
value = parameter - test / action parameter, output from previous action: action 1 , parameter = pOrderNr

Action 1 code:
Code:
Parameter("pOrderNr") = edbOrderNr

Action2 code:
Code:
Dim order
order = parameter("pOrderNr")
msgbox (order)


Anyone see my mistake?

As when the script runs i do not get the parameter passed to action 2 and displayed in message box. It worked yesterday ! Maybe i changed something by accident.



RE: help with passing value to second action - Shrikantsr - 04-19-2011

You can create a Function Library from File menu and declear your variable there as:
Public varname

save the library and rerun the test....

Hope it will be useful..

Regards
Shrikant


RE: help with passing value to second action - jove1776 - 04-19-2011

Sorry Shrikantsr but I dont think that would solve my issue here as it should work with out that.

Is a very strange thing, i think qtp has some issues bugs?

I set up a new test with the following:

action1 code:
Code:
Dim outmessage

outmessage = "this is out message"

Parameter("pOutMessage") = outmessage

Action2 code"
Code:
Dim inmessage

inmessage = parameter("pInMessage")
msgbox(inmessage)

action1 out param = pOutMessage
action 2 in param = pInMessage

action 2 call properties in param = pInMessage and points to the out param of action 1

the message is passed fine!!!!

I did the same with my main test the action 1 variable gets the message but somehow the parameter is just not being passed, is driving me crazy...

does qtp have some sort of cache that can be cleared?

ONE LAST THING.

I have divided my tests the following way. I have one test called Scripts and another test called RegressionTests which call that scripts. In the Scripts test everything in the Action Call Properties seems to be correct, but in the RegressionTest script when i look at the Action Call properties I see there is no option to use parameter from a previous test.


RE: help with passing value to second action - jove1776 - 04-20-2011

I think i found the issue, I was trying to pass the parameter to an action that is on a different testcase hierarchy within the same test. i.e TC0001, contains a number of calls to actions, TC0002 contains a few call to existing actions. Seems that I cannot pass the out parameter from an action in the TC1 set of actions to an action in the TC2 set of actions.

Is working now - but i had add duplicate some actions from TC1 in TC2 which is not very good in my opinion.


RE: help with passing value to second action - raja219 - 05-02-2011

Hi,
Please follow the steps then you can success.

1. Action1 parameters = select Output paramater as 'opvariable' and the type should select as 'Any'.
2. Action2 parameters = select Input parameter as 'opvariable' and the type as 'Any'.
3. parameterise the statement in Action2 as 'order = parameter("opvariable")'.
msgbox order
4. Pass the 'opvariable' in the RunAction statement which we specified at end of Action1 and run the test.

Now you can see the order number which you captured in 'Action1' and passing it to 'Action2'.