Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to retrieve ArrayList saved in Environment Variable
#1
Not Solved
Hi
I created an ArrayList to store dynamic values and saved it in Environment variable.
While retrieving the ArrayList, I am facing Object mismatch exception.

Can any one help me?

regards
Gautam
Reply
#2
Not Solved
Can you please post the code you have been trying?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Not Solved
Hi,
sorry for the delay to post the code. It's as below

Code:
Set array1 = CreateObject( "System.Collections.ArrayList" )
for i=0 to 10
array1.Add(test case name coming from Excel)
Exit for
Environment.Value("array1dtls")=array1

Following one  is retrieval part
Dim arryDtls
[b]arryDtls=Environment.Value("array1dtls")[/b]
MsgBox arryDtls.size

I am getting exception at "arryDtls=Environment.Value("array1dtls")" & Exception is as below

Run Error: Invalid procedure call or argument
Line (240): "arrayCheck=Environment.Value("arr1Dtls")".

Please, advise me what the needful can be done

regards
Gautam
Reply
#4
Not Solved
Does this work,

Code:
msgbox Isarray(arryDtls)
msgbox arryDtls(0)
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Not Solved
Hi basanth

It's not working as expected;
msgbox Isarray(arryDtls)------>False

regards
Gautam
Reply
#6
Not Solved
[quote='Gautam26' pid='25339' dateline='1383730981']
[quote='basanth27' pid='25338' dateline='1383701270']
Does this work,

So, it means that it never came as an array. Can you use the IsArray to verify that it first stored as an array?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#7
Not Solved
Hi Basanth

could you precise the needful to be done ?

regards
Gautam
Reply
#8
Not Solved
Gautam26:

I believe only a string can be saved as an Environment Variable. If you do not want to use a global variable, you will need to convert your arrayList into a string. Then later call the string variable and use split to reuse the array.

hth,

Parke
Reply
#9
Not Solved
Check below link. It might be helpful.

http://www.advancedqtp.com/old_forums/vi...php?t=1712
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP Automation: How to retrieve Reporter.Reportevent Message scsenthil 1 5,417 11-14-2013, 07:51 PM
Last Post: spannerj
  QTP vbscript ArrayList strange behavior frankhovin 2 3,148 11-11-2013, 07:12 PM
Last Post: Parke
Exclamation Retrieve the complete height and width of a browser beyond the visible part as wel learnQtptips 0 2,114 05-22-2013, 09:36 AM
Last Post: learnQtptips
  How to retrieve a value from a table if the application is built in power builder. deepakmehta82 1 2,841 04-26-2013, 07:58 AM
Last Post: shaj
  Issue to use GetVisibleText to retrieve number from a PDF page in QTP11 jsun01 1 2,745 03-09-2013, 09:39 PM
Last Post: jsun01

Forum Jump:


Users browsing this thread: 1 Guest(s)