How to convert a single dimension array to two dimensional array - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: How to convert a single dimension array to two dimensional array (/Thread-How-to-convert-a-single-dimension-array-to-two-dimensional-array) |
How to convert a single dimension array to two dimensional array - venkatesh9032 - 02-10-2014 hello guys, I am transfering csv data into array.. I am getting single dimensional array.. but my requirement is to store csv data into two dimensional array.. so how how can i convert single dimensional array into two dimensional array in qtp// can anyone helpout this, RE: How to convert a single dimension array to two dimensional array - pranikgarg - 02-10-2014 You have not mentioned proper data information with your question. But what I got to know from your question I am sending possible solution: First import that data from CSV to data table by this below formula: DataTable.ImportSheet(FileName, SRCSheetName, DestinationSheetName) After doing this, You will have all the csv data into your specified data table sheet. Now if your data is in two columns, take the count of data from data table and based on the row count, create a for loop till the last count and insert the data in two dimension array like below: Code: Dim a() Use this code and let me know if still there is any problem. RE: How to convert a single dimension array to two dimensional array - venkatesh9032 - 02-10-2014 But pranikgarg my requirement is csv data should not be loaded into datatable or excel...wat eve the file it is loading into single array but the data should be stored into two dimensional array...without loading into data table and excel...the single dimensional array should be converted into two dimensional.. RE: How to convert a single dimension array to two dimensional array - pranikgarg - 02-10-2014 In this case you can use that single dimensional array to create double dimensional array. Get the count of that array and loop through the same array and assign same values to two dimensional array: Code: Dim TwoDimArray() After running this code remove empty element from the array. This code will traverse your single dimensional array and insert each value from the single dimensional array to two dimensional array. |