Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get the total no. of columns used for a particular row
#1
Solved: 11 Years, 4 Months, 3 Weeks ago At 
my code says .
DataTable.SetCurrentRow (2)
now i need to retrive the total number of column used in 2 nd row ..
is there any syntax
what is the substitute of "ddt_get_parameters" used in Winrunner in QTP ..

please reply asap
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Swetha,

For retrieving the columns(Parameters) count in datatable, check the below code.

Code:
datatable.GetSheet("Sheetname").GetParameterCount

Try it n See .... u will get the columns count for any sheets in datatable easily...


Regards,
Sreekanth CR
sreekanth.chilam@gmail.com
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Sreekanth ,
This code retrives total column count of the sheet .
I want to retrieve column count of just 1 particular row ..
suppose i have 3 row .. 1 row has 6 colunm and 2 nd one has 3
third one has 4 .. so how to retrive the column count of 2nd row
please reply asap
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Sreekanth ,
This code retrives total column count of the sheet .
I want to retrieve column count of just 1 particular row ..
suppose i have 3 row .. 1 row has 6 colunm and 2 nd one has 3
third one has 4 .. so how to retrive the column count of 2nd row
please reply asap
Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago Rolleyes 
Code:
Dim rc,cc
rc=datatable.GetRowCount
msgbox rc

For i=2 to 2
    cc=datatable.GetSheet("Global").getparametercount
    msgbox cc
Next
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
HI Swetha,

I wrote one user defined function which takes requires row number as an Input argument/Parameter.

1. Refer the below function defination :

Code:
Function Column_Count_Retrieve(Rownumber)
     Datatable.Getsheet("Global").SetCurrentrow(Rownumber)
     Temp=0  
            Col_Count=Datatable.GetSheet("Global").GetParametercount      
                 for j=1 to Col_Count
                         Val=Datatable.GetSheet("Global").GetParameter(j).Value
                               if Val<> "" then
                                     Temp=Temp+1
                               end if
                  Next
      msgbox   "Row  " &Rownumber&"   :   "&Temp&" rows"
End Function

2. Call the above function as given below :

Call Column_Count_Retrieve(3) ' Calling the function for finding the no. of columns used by 3rd Row
Call Column_Count_Retrieve(1) ' Calling the function for finding the no. of columns used by 1st Row
Call Column_Count_Retrieve(2) ' Calling the function for finding the no. of columns used by 2nd Row

I hope now your requirement has been solved.
Reply
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
Hello bfakruddin , i guess you need to change the code. Smile
Reply
#8
Solved: 11 Years, 4 Months, 3 Weeks ago
Sorry,
I have check only 2nd column, not for all rows... Sreekanth given beautiful code...
You can use that...
Reply
#9
Solved: 11 Years, 4 Months, 3 Weeks ago
Code:
datatable.columncount(rows)

webtable.columncount(rows)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Comparing two unsorted excel columns ProTester 2 2,835 09-13-2018, 02:11 PM
Last Post: ProTester
  Searching for and selecting row in Datawindow zsl0009 0 2,840 08-04-2015, 01:02 AM
Last Post: zsl0009
  Fetching total number of records inside a webtable vidya2k2 2 3,963 06-15-2015, 02:55 PM
Last Post: venkatesh9032
  How to Delete Rows with duplicate values in 1 columns in excel thru QTP. arpan 0 2,852 02-09-2015, 08:47 PM
Last Post: arpan
  How to get center data value in a odd number of rows and columns web table ... sai rajesh 0 2,836 11-13-2013, 10:24 PM
Last Post: sai rajesh

Forum Jump:


Users browsing this thread: 1 Guest(s)