SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Oct 2006
    Posts
    58
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to create and Storing multidimensional array

    Hi,
    I have a requirement to store the data from the datatable (which consist 3 columns ) in to an array.
    I have 3 columns in my datatable i:e; Class,rollnum,attendance and the rows are 15. I need to store all the data into an array, for example Myarray(class,rollnum,attendance) . Although i have generated script to retrieve the individual column values but not able to store them in to an array.
    Please help me out of the situation. Please provide some idea how to create and store multidimensional arrays.
    Any sample codes would definitely help me .
    Thanks in Advance

  2. #2
    Senior Member
    Join Date
    Jun 2007
    Location
    IL, US
    Posts
    408
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to create and Storing multidimensional array

    How about concatenating the three values using a delimiter and storing the values in a one dimensional array

    Arr(0) = "Class|rollnum|attendance"
    Arr(1) = "Class1|rollnum1|attendance1"

  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    58
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to create and Storing multidimensional array

    Not Actually, I want to store the entire "Class" column in to an array, entire "RollNum" in to another array....and so on .
    is there anyway ?

  4. #4
    Senior Member
    Join Date
    Mar 2010
    Location
    12.985475,80.229696
    Posts
    168
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to create and Storing multidimensional array

    Why don't u use 2 dimensional array, QTP help says it will support upto 60 dimensions.

    Dim MyTable(11, 3)

    MyTable(1, 1) = "Class1"
    MyTable(1, 2) = "Rollnum1"
    MyTable(1, 3) = "Att1"
    MyTable(2, 1) = "Class2"
    MyTable(2, 2) = "Rollnum2"
    MyTable(2, 3) = "Att2"
    MyTable(3, 1) = "Class3"
    MyTable(3, 2) = "Rollnum3"
    MyTable(3, 3) = "Att3"
    For i = 1 to 3
    For j = 1 to 3
    msgbox MyTable(i,j)
    Next
    Next

  5. #5
    Member
    Join Date
    Oct 2009
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to create and Storing multidimensional array

    Hi, you can use this code as well...

    'shtname is your current sheet name from local datatable

    RC = DatabTable.GetSheet("shtname").RowCount
    ReDim class(RC)
    ReDim rollnum(RC)
    ReDim attendance(RC)
    For i = 1 to RC
    DataTable.SetCurrentRow(i)
    class(i-1) = DataTable("Class","ShtName")
    rollnum(i-1) = DataTable("rollnum","ShtName")
    attendance(i-1) = DataTable("attendance","ShtName")
    Next
    school = Array(class,rollnum,attendance) 'nx3 matrics

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:14 PM.

Copyright BetaSoft Inc.