# Not sure what is wrong here

**URL:** <https://www.ruby-forum.com/t/not-sure-what-is-wrong-here/106110>\
**Category:** Ruby\
**Created:** [June 6, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/not-sure-what-is-wrong-here/106110 "2007-06-06T15:31:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 6, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/not-sure-what-is-wrong-here/106110/1 "2007-06-06T15:31:20Z")

</div>

i am not sure what is wrong here  
tablearr is of type FASTERCSV::TABLE  
eachrow is of type FASTERCSV::ROW  
as per the fastercsv doc, the table.values\_at returns a array.  
the array has method .include?

def checkduplicates(eachrow,tablearr,indx,criteria)  
eachrow.each{|name,valu|  
rowdata=tablearr.values\_at(indx+criteria)  
if(rowdata.include?valu)\<\<\<\<\<\<\<\<\<\<\<\<\< ERROR HERE.  
puts “match”  
end

}

c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib/faster\_csv.rb:  
345:in `==': undefined method`row’ for “03”:String (NoMethodError)  
from scan.rb:7:in `include?’

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 6, 2007, 3:52pm UTC](https://www.ruby-forum.com/t/not-sure-what-is-wrong-here/106110/2 "2007-06-06T15:52:23Z")

</div>

On Jun 6, 2007, at 8:30 AM, Junkone wrote:

> ```
> puts "match"
> 
> ```
> 
> end
> 
> }
> 
> c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib/faster\_csv.rb:  
> 345:in `==': undefined method`row’ for “03”:String (NoMethodError)  
> from scan.rb:7:in `include?’

I’m happy to help debug this, but it would be much easier if I had  
some code I could run. Could you try reducing the error to a simple  
little script, using included dummy data, that shows the problem?  
When I see that, I’m sure I can provide some suggestions.

James Edward G. II

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 6, 2007, 7:28pm UTC](https://www.ruby-forum.com/t/not-sure-what-is-wrong-here/106110/3 "2007-06-06T19:28:16Z")

</div>

On Jun 6, 9:50 am, James Edward G. II [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > the array has method .include?  
> > c:/ruby/lib/ruby/gems/1.8/gems/fastercsv-1.2.0/lib/faster\_csv.rb:
> 
> - Show quoted text -  
> Hello  
> Thanks for your response. attaching the script and data

data  
No,S/W,Day,Month,Year,N1,N2,N3,N4,N5,N6,Bn,Sum  
1,Sat,12 ,June,1982,03,11,12,14,41,43,13,124  
2,Sat,19 ,June,1982,08,33,36,37,39,41,09,194  
3,Sat,26 ,June,1982,06,01,23,24,27,39,34,120  
4,Sat,03 ,July,1982,03,09,10,13,20,43,34,98  
5,Sat,10 ,July,1982,05,14,21,31,34,47,45,152  
6,Sat,17 ,July,1982,08,20,21,25,31,41,33,146  
7,Sat,24 ,July,1982,18,25,28,33,36,42,07,182

script  
require “faster\_csv”  
SEARCH\_CRITERIA=1

def checkduplicates(eachrow,tablearr,indx,criteria)  
eachrow.each{|name,valu|  
rowdata=tablearr.values\_at(indx+criteria)  
if(rowdata.include?valu)  
puts “match”  
end

}

end

tablearr = FasterCSV.read(“c:\ruby\testing\data.txt”,  
{:headers=\>true,:skip\_blanks=\>true})  
tablearr.by\_col!()

tablearr.delete(“No”)  
tablearr.delete(“S/W”)  
tablearr.delete(“Day”)  
tablearr.delete(“Month”)  
tablearr.delete(“Year”)  
#puts tablearr  
tablearr.by\_row!()  
tablearr.each\_with\_index{|eachrow,indx|  
checkduplicates(eachrow,tablearr,indx,SEARCH\_CRITERIA)

# puts indx

}
