On Sep 29, 2007, at 1:02 AM, johnf wrote:
> At this moment I don't recall why a bizobj wasn't used. But could > you explain > how the data set's SQL capabilities might have been used?
I would tend to let the server do these calcs, and then dynamically change the displayed column. Let's assume the value was stored in kilos in the database: I would write the query like:
select weight as kilos, weight/2.2 as pounds, weight as displayed, ...
Then when the user changes the display, I'd iterate through the dataset and replace all the 'displayed' values with either the metric or imperial value, as needed.
Larry indicated that he didn't want to do this in the query, nor did he want to requery the database, so I suggested working directly with the dataset. Let's assume that you have the query above and get the resulting dataset; to change to displaying pounds, just do:
newdata = dataset.execute("select weight as kilos, weight/2.2 as pounds, weight/2.2 as displayed, ... ")
and then use the 'newdata' dataset for your grid.
-- Ed Leafe -- http://leafe.com -- http://dabodev.com
©2007 Ed Leafe |