Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Actions
#1
Not Solved Cool 
Hi,

Can anybody give the sample code for returning multiple values for an Action.

Code:
Dim retval
retval=RunAction("Action1",OneIteration)
msgbox "Returned value of the Action is : " & Chr(32) & retval
' it will return xxxxxxx value

ExitAction(xxxxxx)

here, it is returning a single value... But, Action returns multiple values how it will return multiple values. please give me the sample code.
Reply
#2
Not Solved
'Sample code
-------------------
Code:
'Driver Action
RunAction "Mats",oneiteration,5,2,iAdd,iMul,iSub
' Here A=5,B=2 are "Mats" action's input parameters and iAdd,iMul,iSub are "Mats" action's output parameters.
msgbox iAdd
msgbox iMul
msgbox iSub

' Mats Action
Parameter("iAdd") = Parameter("A") +Parameter("B")
Parameter("iSub") = Parameter("A") -Parameter("B")
Parameter("iMul") = Parameter("A")*Parameter("B")
Reply
#3
Not Solved
Thank you Rajasekhar,

you have used the output parameters here to get the values from Action, Even we can do that by using Functions...

I'm asking that the Action returned value as I showed in my script by using

Code:
retval = ExitAction(retval)

Actually, Action can returns multiple values... how it will do that.

I hope you got my question. If you need any further information please revert me.
Reply
#4
Not Solved
Hi,

I tried this using dictionary object.

Action 1
‘==========================

Code:
Dim ODictAction1
Set ODictAction1 = CreateObject("Scripting.Dictionary")

                Set ODictAction1 = Runaction("Action2", Oneiteration)

    a = ODictAction1.Items   ' Get the items.
   For i = 0 To ODictAction1.Count -1 ' Iterate the array.
      msgbox  s & a(i)
   Next


Action 2
‘===================

Code:
Dim ODictAction2

Set ODictAction2 = CreateObject("Scripting.Dictionary")

ODictAction2.Add "a", "Athens"   ' Add some keys and items.
ODictAction2.Add "b", "Belgrade"
ODictAction2.Add "c", "Cairo"

ExitAction (ODictAction2)
Reply
#5
Not Solved
Hi Rajesh,

It is not always suggestable to go with Dictionary Objects why because these are system specific and it is not script specific. I mean to say whatever the object you have created that might be in ur system(regedit) if u execute the same script in another system then it may not run as you expected probably the created object may not be available in another system for that you need to create that object in regedit so instead of that it would be better to go with RunAction "Action Name","Iteration","Input Parameters","Output Parameters"

Please let me know if you need any clarification on this.


Venkat.Batchu
Reply
#6
Not Solved
Hi Venkat,


I need more information on what are you trying to say. Yes we need to have entry on the regedit and which is by default present in the registry for all windows system. Why do you think it will not run unless some person intentionally done the changes to the registry.


Thanks
Rajeshwar
Reply
#7
Not Solved
Hi,

Dictionary object is not the default one for all windows systems, u need to add the object(object name is any) to regedit

Note: try by using dictionary objects in different system and then u come to know what is the thing u need to configure before executing.

For ur reference:
https://www.learnqtp.com/dictionary-object-qtp-use/


Venkat.Batchu.
Reply
#8
Not Solved
Hi,

The reference you have given is for using the Reserved objects. I am not using the reserved object I just making use of environment object which always available. Reserved Objects in regedit are used to create Singleton objects which not the case here. We using the object referecne for other object which is not restrictive and can be used on any windows operating system without restriction. Please let me know in case you need more information.
Reply
#9
Not Solved
Hi Rajeshwar,

As i discussed above is regarding dictionary objects and i agree with you that environment variables object is by default in all windows systems which is not system specific but dictionary objects are system specific.


Venkat.Batchu
Reply
#10
Not Solved
Hi Venkat,

I disagree with your comments. Dictionary object are not system specfic they can be used by any languge C#, VB, C++, F# and you can refer to MSDN for more details. These objects are extensively used in C#. I havn't made any changes to my regedit to make use of it. Secondly I even checked my reserved objects there is no entry of Scripting.Dictionary.

For ur reference:
http://msdn.microsoft.com/en-us/library/...S.85).aspx
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)