main logo
Subject: Re: [dabo-users] Virtual fields for a ds
Author:
Posted: 2007/09/29 17:30:31
 
View Entire Thread
New Search


Ed,

The main reason that I don’t want to put it into a select statement is that
there are quite a number of display rules (per record) that determines how
the info is to show on the grid. Using the get and setValue of the
dGridDataTable, I can control the formatting and actual input of the cell
using as much logic as needed.

For example, I can have a mix of bulk and packaged good units.

type qtyonhand type qtytomove
SEED 200 lbs BULK
CAN SEED 60 8 oz CAN
BAG 20 50 lbs BAG

Using the get/setValue, I can make the display respond to a user selection
of a Kilo/Lbs option at the top of the form. When toggled, all weights on
all pages of the form are dynamically reformatted. If the user has made
changes and just wants to switch between Kilo/Lbs and we had to requery a
bizobj every time then the user would be forced to update or cancel changes.
Another display rule is if the user is in Kilo mode, it would show something
like "94.234 Kg" or if the qty is less than 1000 it shows the value in
grams, "235 g" vs "0.235 Kg"

Further, using the get/setValue, I have been able to program the form to
display 10 lbs 5 oz, if the user types in 10.5 in the qtytomove cell (a nice
shortcut if I do say so myself).

I am really getting into this and think it's very cool that I can control
the grid display (and input) to this extent!

Larry Long




-----Original Message-----
From: dabo-users-bounces .at. leafe DOT com [mailto:dabo-users-bounces@leafe.com] On
Behalf Of Ed Leafe
Sent: Saturday, September 29, 2007 4:00 PM
To: Dabo Users list
Subject: Re: [dabo-users] Virtual fields for a ds

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




[excessive quoting removed by server]


 
©2007
<-- Prior Message New Search Next Message -->