Welcome, Guest. Please login or register.
Login with username, password and session length

 
Advanced search

18488 Posts in 4838 Topics- by 32654 Members - Latest Member: revitvm
 

AdvancedQTP forums have been nominated as a finalist in ATI’s 2nd annual automation honors awards!

We’d like to thank you for your continued support and participation, and urge you to hurry and vote.

Make you voice count! 


Pages: [1]   Go Down
Print
0 Members and 1 Guest are viewing this topic.
Author Topic: Please help me out Gurus..........    (Read 547 times)
amit tiwari
User
*
Offline Offline

Posts: 3


« on: June 12, 2009, 03:42:21 AM »

I have a query for all the Gurus, Please help me out:

I need an array which will be available for all actions and it could store some data from every actions. and in the last action I wanted to use all the collected data.
I have tried a lot didnt get the desired result.
Thanks in advance!!
Logged
Manoj Kulkarni
Full User
***
Offline Offline

Posts: 241



« Reply #1 on: June 12, 2009, 03:45:51 AM »

Hi,
   Try to use Global Dictionary object ...or declare array globally
Logged

Regards,
Manoj Smiley
amit tiwari
User
*
Offline Offline

Posts: 3


« Reply #2 on: June 12, 2009, 04:13:55 AM »

Thanks Manoj for a quick reply, But i am not able to convert ur suggestion into fruitfull result

how could i make dictionary object/Array globaly?
i tried with the following code:

Action1:
Set result = CreateObject("Scripting.Dictionary")
result.Add "a", "Pass"   
- - - - - - - - - -
- - - - - - - - - -

Action2:
result.Add "b", "Fail"
here i'm again getting error msg: Object required:result

Please suggest me how to do it. Thanks
Logged
Manoj Kulkarni
Full User
***
Offline Offline

Posts: 241



« Reply #3 on: June 12, 2009, 04:58:53 AM »

Hi Amit,
   Search for "Sharing Values Using the Dictionary Object " in QTP Help
Logged

Regards,
Manoj Smiley
niranjan deka
FRProject
Full User
*
Offline Offline

Posts: 226


« Reply #4 on: June 12, 2009, 06:21:14 AM »

Hi amit,

The way you are accessing the dictionary objects in action2 is not correct because you hav created one instance in action 1 and try to access it on action2 which is out of scope.Do try to add the disctionary object declaration in a vbs file and then attached it to QTP interface or call it at run time and then then try to access it in your QTP test/actions. eg

'declare this on VBS file
set Obj=createobject("scripting.Dictionary")
Obj.add "A", "Apple"

'QTP  expert View
'Action1
msgbox obj.item("A")'Print value-"Apple"
Obj.add "B", "Banana"

'Action2
msgbox Obj.item("B") ' print value -"Banana"

Hope that this make some sense for you Wink

regards
Niranjan



Logged
Anshoo Arora
Advanced User
*****
Offline Offline

Posts: 855



WWW
« Reply #5 on: June 12, 2009, 12:40:56 PM »

Quote
how could i make dictionary object/Array globaly?

Store the Dict/Array variable in a library file; ie. outside the script file.

Are you associating your function libraries or executing them on runtime?
« Last Edit: June 12, 2009, 12:42:31 PM by Anshoo Arora » Logged

Best Regards,

Anshoo Arora
AdvancedQTP Forums Moderator

http://relevantcodes.com - My Blog
amit tiwari
User
*
Offline Offline

Posts: 3


« Reply #6 on: June 14, 2009, 11:48:59 PM »

Thank you very much "Niranjan", I appreciate ur detailed description
Logged
Pages: [1]   Go Up
Print
Jump to: