Thank you, Tiffany!

On Apr 18, 10:26 am, Tiffany Fodor <[email protected]> wrote:
> Hi!
>
> You're almost there.
>
> I use Xls.rb as well and to check for blank rows, I usually use
> something like this:
>
> myData.each do |record|
>   if record['WHERE'] != ''
>     ie.frame(:name, "main").text_field(:name,
> 'account').set(record['WHERE'])
>     ie.frame(:name, "main").text_field(:name,
> 'item').set(record['WHAT'])
>   end
> end
>
> This will skip rows where the 'WHERE' column is blank.
>
> I can't tell how many rows you're importing from your code, so if
> you're not already, you may want to limit the number of rows you're
> importing from Excel.  I usually bring back about 5-10 rows past where
> my data ends so that if I add a couple more rows, I won't have to
> change the import range from Excel.  You don't want to bring back all
> the rows in the spreadsheet or your framework will need to check each.
>
> Hope this helps!
>
> -Tiffany
>
> On Apr 15, 4:09 pm, mdwin01 <[email protected]> wrote:
>
>
>
> > Hi-
>
> > Could someone help me figure out how to skip over blank Excel rows
> > (where the first item in the array is "" or length=0) and continue to
> > the next row?  I use xls.rb 
> > (http://wiki.openqa.org/display/WTR/Excel+interface+class
> > ) to read Excel workbook cells that each contain a formula, where
> > everything defaults to "" or zero length blank.
>
> > Here's a sample xls (note how second to the last row appears blank):
> > Import
> > WHERE   WHAT
> > Account1        Apple
>
> > Account3        Orange
>
> > Here's a snippet of my code:
>
> > require 'xls'
> > require 'rubygems'
> > require 'watir'
>
> > ie = Watir::IE.attach(:url, 'http://www.blah.com) #reuse existing
> > browser window
>
> > #Open Excel file, Import worksheet
> > xlFile = XLS.new('C:\MyFile.xls') #grab the data file
> > myData = xlFile.getRowRecords('Import','Import')  #pull data records
> > from Excel
> > xlFile.close
>
> > myData.each do |record|
>
> >   #need something that says if record['WHERE'] = "" or 0 length then
> > skip to next row
> >   ie.frame(:name, "main").text_field(:name,
> > 'account').set(record['WHERE'])
> >   ie.frame(:name, "main").text_field(:name,
> > 'item').set(record['WHAT'])
>
> > end- Hide quoted text -
>
> - Show quoted text -

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to