Hi all,
I’m very new to this forum and actually this is my first question.
I got confuse with servoy and I’ve no idea how to solve it.
My problem is
-
one of the column in my table view that is not directly from Database, it is something like amount (quantity * unitprice , which are database fields). I can calculate the amount in table view by using calculation function of dataprovider.
-
but i want to display under table view for sum of calculated amount in the table view.
if you have any suggestion pls reply me
S.O.S
Dennis
In order to use a Aggregate in Servoy to perform the Sum, the calculation must be stored. To do this, you just need to add a column to that table and name the column the exact same name as the calculation. Then you will be able to create an Aggregate to sum the column and you can display it on your form.
If you can’t, or don’t want to store that calculation, there are a few more advanced options…
-
You could loop through the calculations and add to a global variable, and then display that global on your form…essentially doing the sum yourself, but that doesn’t scale very well, so it generally not recommended.
-
You can use databaseManager.geDataSetByQuery and run a sql query against your databse and have it perform the sum on the calculation. Like,
SELECT SUM(quantity * price) FROM orders
WHERE ordernumber = ?
Then you can again set a global to the result so it can be displayed on your form
hi goldcougar
thanks for your solution.
its solve my problem.
but in my case i can’t add a new column to the table, cos i just a programmer, i’m not a db administrator.
so i used your second option to solve.
thanks indeep
Dennis