K
Kamarulnizam Rahim
Hi guys,
I have some problem while obtaining data from the csv file format. Here
is the output of the csv file after being loaded in ruby:
"1.a | Maximise use of natural lighting | | Active | | | | | | "
"1.b | Turn-off unnecessary lights/equipment | | Active | | | | |
| "
Using the following code:
row_num = 0
@data = []
CSV.foreach('ActionPlan.csv') do |row|
@data << row
pp "#{row[0]} | #{row[1]} | #{row[2]} | #{row[3]} | #{row[4]} |
#{row[5]} | #{row[6]} | #{row[7]} | #{row[8]} | #{row[9]}"
#unless row[1] =~ /^\[x\]
row_num += 1
end
puts "#{row_num} rows"
My problem is to obtain the 'Active' results and transfer it into
another class which already existed. Do i need to convert the data into
ruby or yaml structures first? (since the purpose of my project is to
produce a yaml file). Thanks in advance
Nizam
I have some problem while obtaining data from the csv file format. Here
is the output of the csv file after being loaded in ruby:
"1.a | Maximise use of natural lighting | | Active | | | | | | "
"1.b | Turn-off unnecessary lights/equipment | | Active | | | | |
| "
Using the following code:
row_num = 0
@data = []
CSV.foreach('ActionPlan.csv') do |row|
@data << row
pp "#{row[0]} | #{row[1]} | #{row[2]} | #{row[3]} | #{row[4]} |
#{row[5]} | #{row[6]} | #{row[7]} | #{row[8]} | #{row[9]}"
#unless row[1] =~ /^\[x\]
row_num += 1
end
puts "#{row_num} rows"
My problem is to obtain the 'Active' results and transfer it into
another class which already existed. Do i need to convert the data into
ruby or yaml structures first? (since the purpose of my project is to
produce a yaml file). Thanks in advance
Nizam