D
Daniel Malcolm Webb [dbw]
Hi all,
I've stumbled again. I'm currently trying to iterate though a result
output from PostgreSQL. Here's the database; I've been able to query
that I am getting all 5 records, however I don't seem to be able to
iterate through the second column i.e. 1,2,3,4,5.=20
=20
7494;"1";"The origin (0,0) is top left.";TRUE;"1.0";"NOTE: Question
imported from map";"Correct.";;
7494;"2";"The origin (0,0) is top
right.";FALSE;"-0.25";"";"Incorrect.";;
7494;"3";"The origin (0,0) is bottom
left.";FALSE;"-0.25";"";"Incorrect.";;
7494;"4";"The origin (0,0) is bottom
right.";FALSE;"-0.25";"";"Incorrect.";;
7494;"5";"The origin (0,0) is located in the centre of the
screen.";FALSE;"-0.25";"";"Incorrect.";;
=20
=20
What I'm currently using is:
num_options =3D res_qo.to_a.length
puts num_options
puts res_qo.to_a
for i in (1..num_options)
puts res_qo.to_ary[0][1]
end
=20
The result is an array of arrays by the looks of it (unless someone can
point out I've got the wrong end of the stick), but I can't move on from
the first record and am currently getting:
1
1
1
1
1
=20
Any ideas would be great, as this should be one of the last problems I
have to sort out for this migration script.
=20
Cheers,
Dan
=20
I've stumbled again. I'm currently trying to iterate though a result
output from PostgreSQL. Here's the database; I've been able to query
that I am getting all 5 records, however I don't seem to be able to
iterate through the second column i.e. 1,2,3,4,5.=20
=20
7494;"1";"The origin (0,0) is top left.";TRUE;"1.0";"NOTE: Question
imported from map";"Correct.";;
7494;"2";"The origin (0,0) is top
right.";FALSE;"-0.25";"";"Incorrect.";;
7494;"3";"The origin (0,0) is bottom
left.";FALSE;"-0.25";"";"Incorrect.";;
7494;"4";"The origin (0,0) is bottom
right.";FALSE;"-0.25";"";"Incorrect.";;
7494;"5";"The origin (0,0) is located in the centre of the
screen.";FALSE;"-0.25";"";"Incorrect.";;
=20
=20
What I'm currently using is:
num_options =3D res_qo.to_a.length
puts num_options
puts res_qo.to_a
for i in (1..num_options)
puts res_qo.to_ary[0][1]
end
=20
The result is an array of arrays by the looks of it (unless someone can
point out I've got the wrong end of the stick), but I can't move on from
the first record and am currently getting:
1
1
1
1
1
=20
Any ideas would be great, as this should be one of the last problems I
have to sort out for this migration script.
=20
Cheers,
Dan
=20