Highlighted
Contributor.
Contributor.
1223 views

Not able to store Array in Environment variables in UFT

Hi Friends,

 I was trying to store an array in Environment Variable, But I could not store the array in global scope ( i.e Env Variable)

Could you please let me know how to store a array in Environment variable

 

Sample code

Dim ary()

ReDim ary(1,1)

ary(0,0)="TEST"

ary(0,1)="TEST"

ary(1,0)="TEST"

ary(1,1)="TEST"

Environment.Value("TestAry")=ary

 

Abouve code is not working, If I store array in another variable then i am able to save the array in Environment variable

e.g ;

tempAry = ary

Environment.Value("TestAry")=tempAry

 

 

 

0 Likes
1 Reply
Highlighted
Regular Contributor.
Regular Contributor.

Re: Not able to store Array in Environment variables in UFT

Hi,

I have tested below code and it is working fine without using temporary variable:

Dim arrSample

ReDim arrSample(1,1)

arrSample(0,0)=1

arrSample(0,1)=2

arrSample(1,0)=3

arrSample(1,1)=4

Environment.Value("Test")=arrSample

Msgbox Environment("Test")(1,0)

It will give output --> 3

Try to replicate like above in your code. I have added parameters after "Environment variable" in order to access value of an array.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.