Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Global Array re dimension inside an action
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,
I'm trying to re-dimension a global array declared in a library file associated to my test. I'm using the ReDim sentence inside an action but I get "Illegal assignment" error.
This is what I have:

in a library file (library.qlf):

Code:
Dim dinamicArray()  'define a global dinamic array

in an action of a qtp test case:
Code:
...
ReDim dinamicArray(2)
....

I link the library file to the test and the global array is recognized in the action but I get "Illegal assignment" error at run time.

Would appreciate any kind of help
Martin
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
You can not ReDim an array in an action which is declared in a library file,
You should have both Dim and ReDim either in the library file or in the Action itself.

what you can do here is declare the variable as Public(if you need) in the action only and then ReDim as per your need in that action.

Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Ok, thanks for the comment. I implemented a workaround to solve it:

in the library file (library.qlf):

Code:
Public dinamicArray()  'define a global dinamic array

Public Function ReDimArray(ArrayName, num)
    Execute "ReDim "&ArrayName&"("&num&")"
End Function

in an action of a qtp test case:
Code:
Call ReDimArray("dinamicArray",0)
Call ReDimArray("dinamicArray",1)
Call ReDimArray("dinamicArray",2)

It is a workaround just to solve the library limitation. Thanks Saket.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Read Content inside PDF kotaramamohana 0 1,226 09-02-2020, 05:49 PM
Last Post: kotaramamohana
  Fetching total number of records inside a webtable vidya2k2 2 3,966 06-15-2015, 02:55 PM
Last Post: venkatesh9032
  How to get a specific image inside a webtable grave711 7 9,080 05-29-2012, 10:44 AM
Last Post: grave711
  Global Dictionary digikiwam 1 3,689 04-12-2012, 02:50 PM
Last Post: rajsunder_r
  QTP cannot recognize a web form inside SAP QTP_Gaspar 2 4,337 01-13-2012, 12:19 AM
Last Post: QTP_Gaspar

Forum Jump:


Users browsing this thread: 4 Guest(s)