Aparajita,
We have found your RowSet library to be very useful for some of the
programming we're doing, especially its ability to create a rowset
directly from multiple arrays.
We found, however, that we needed an additional method to search a
rowset's given column for a specific value. Because of this need, we
wrote the method below:
method "Find"($ioRowSet; $inColumn; $inValue)
BeforeFirst($ioRowSet)
while (Next($ioRowSet))
if (string(GetData($ioRowSet; $inColumn)) = string($inValue))
return (true)
end if
end while
return (false)
end method
Example use:
if (Find($rsCustomers; "ID"; 123456))
writebr("Name: " + GetData($rsCustomers; "Name"))
else
writebr("Can't find that customer.")
end if
Could the RowSet library itself provide similar search functionality (at
least for simple data types)? I'm asking here on the mailing list to see
if our fellow A4Ders have any comments or recommendations in this area.
On another note, it would also be really nice to be able to access a
column's value for the current row without having to call the
RowSet.GetData method all the time.
For example:
writebr("Name: " + $rsCustomers{"Name"}) // $rsCustomers is a
rowset
I do, however, acknowledge that this could raise some potential issues
with the RowSet's implementation. (The current row's values would have
to refill these values every time the row position changes, these column
names could conflict with some of the internal rowset variables, etc.)
But still, I could find it useful - what do you all think?
Regards,
David Valles
Pensacola Christian College