[Gambas-user] Calculated fields

William Chapman wrchap001 at ...626...
Mon May 25 09:57:32 CEST 2015


Hi Everyone!

My first post to the forum and my first project!

Being new to Gambas, I have got stuck on trying to use Gambas to create a
front-end for a MySQL database created with MySQL Workbench. I have trawled
the Internet without much success for an answer.

The application that I am working on requires calculated fields. Using
MySQL
workbench the calculated field has been produced by using a MySQL query.

For example:

select quantity, price, (quantity * price) as subtotal
from components
order by quantity, price, subtotal desc

Following a Youtube video showing how to "import" data held in a MySQL
database into a Gambas front-end, the form is constructed using the
DataSource and the DataBrowser options from the Toolbox.

While the fields of "price" and "quantity" are shown, being obtained from
the
table "components", I have not been able to figure out how to source the
calculated field i.e. quantity * price and its value (as obtained via the
SQL
query) in order to place it into the Gambas front end.

e.g:-

amount              price            subtotal
10                        50                   500

Any possible suggestions or reference to an available coding example would
be
greatly appreciated.

Regards
William
Cape Town
South Africa



More information about the User mailing list