Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get row count if xls file is generating dynamically.
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Venkat,
Thanks for your reply with detailed steps. Its really very great for your help. Requirement is slight changed, because we have to save file name in any drive (C or D) and give the name for xls and pass this excel file for row count. I have done in the following way. It is working but i am not sure this is correct coding practice or not?
One more Question: I have many this kind of scenarios to validate xls row count. Is there any other way to write code optimization like function or Descriptive programming. Kindly suggest your approach.
Thanks for your help. Please refer below code FYI


Code:
Window("Lilly Science Grid").Page("Page_3").Link("25").Click
wait(2)
rowCnt = Window("Lilly Science Grid").Page("Page_3").Link("25").GetROProperty("text")
convLng = CLng(rowCnt)
msgbox rowCnt
wait(3)
SwfWindow("Lilly Science Grid").Dialog("File Download").Click 285,18  
SwfWindow("Lilly Science Grid").Dialog("File Download").Activate
SwfWindow("Lilly Science Grid").Dialog("File Download").WinButton("Save").Click
wait(5)
Dialog("Save As").Activate
Dialog("Save As").WinEdit("File name:").Set "D:\tumo.xls"
Dialog("Save As").WinButton("Save").Click
Dialog("Save As_2").WinButton("Yes").Click
Dialog("Download complete").Click 321,184
Dialog("Download complete").WinButton("Close").Click

fileName = "D:\tumo.xls"
Set xlObj = CreateObject ("Excel.Application")
Set wBook = xlObj.workBooks.Open(fileName)
Set sheetName = wBook.worksheets("Sheet1")
'Set sheet = xlObj.ActiveWorkbook.worksheets("sheet1")
column_count = sheetName.usedrange.columns.count
row_count  = sheetName.usedrange.rows.count
xlsRowCnt = row_count -1
msgbox xlsRowCnt

If xlsRowCnt  = convLng Then
    reporter.ReportEvent micPass, "Row Count Validation","Row Count matching with column header. Step.Pass"
    else
    reporter.ReportEvent micFail, "Row Count Validation","Row Count is not matching with column header.Step.Fail"
End If
wBook.close
Reply


Messages In This Thread
RE: How to get row count if xls file is generating dynamically. - by iamsekhar - 08-25-2010, 01:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to dynamically find the OracleFormWindow? arpan 0 1,766 04-26-2017, 12:45 AM
Last Post: arpan
  How to click on all links dynamically in UFT? Rohan 9 18,466 02-25-2016, 10:42 AM
Last Post: vinod123
  Searching for and selecting row in Datawindow zsl0009 0 2,798 08-04-2015, 01:02 AM
Last Post: zsl0009
  How to Verify Static Object Text which is changing Dynamically with Expected Result johnny77 0 3,294 06-25-2015, 11:32 AM
Last Post: johnny77
  SAPGuiSession get the active SAPGuiWindow dynamically cko77 2 5,316 01-27-2014, 12:04 PM
Last Post: cko77

Forum Jump:


Users browsing this thread: 5 Guest(s)