Page 1 of 1

Calculation FIelds Do not Appear in The Form

PostPosted: Wed Sep 09, 2015 4:19 pm
by cuoredisardegna
Hi to All,

could AnyOne Know how to resolve this problem?

I have a form wiht a list of the invoices.

In this form there are 3 fields:
1.) The Name of the customer —customer—;
2.) The amount of the invoice —tot_invoice— (calculation );
2.) The amount of the tax —tot_tax— (calculation).

But, if I want to see the list, many fields of many records (13000 of 20000) do not appear in the form. The fields are the calculation fields: tot_invoice, and of tot_tax.

Only if I wait some time, the only fields of the page of the form in front of me are loaded, but not those of all the records.

But in this manner it is needed too long time to load all the fields of 13000 records.

Could Someone suggest a command to load all the fields of all the records.
Does perhaps exist a SQL command (I'm using postgresql).

I hope I was clear.

Tanks in advance.

Gianni Pinna

Re: Calculation FIelds Do not Appear in The Form

PostPosted: Wed Sep 09, 2015 5:03 pm
by jdbruijn
Take a look at databasemanager.recalculate()
But do you really need that many records updated at once? Seems like a bit much to me.

Re: Calculation FIelds Do not Appear in The Form

PostPosted: Wed Sep 09, 2015 5:26 pm
by cuoredisardegna
Hi Joes,

tank You for Your prompt answer.
Yes I need to recalculate all the records, and I also am tinking it will be expensive. Therefore I was asking if the SQL command update could resolve, but I am not sure.

Tank You Joes.

Sincerly.
Gianni Pinna

Re: Calculation FIelds Do not Appear in The Form

PostPosted: Wed Sep 09, 2015 9:17 pm
by mboegem
Hi Gianni,

For a better understanding of the problem: are these stored or unstored calculations?
databaseManager.recalculate() will only be helping you when you use stored calculations as the calculated result will be stored in an actual database column.

While talking about storing data ;-)
I'd strongly advice to only store the data in a real column (don't even bother doing this by a calculations)
Calculations are great to concatenate data from 1 table (ie. first + lastname), but as soon as they involve databaseoperations (read: joins to foreign tables) you should stay away using them.
Well, at least if you want to end up having an application with a great performance.

If you really need to go the 'live result' path, try use aggregates.

Hope this helps

Re: Calculation FIelds Do not Appear in The Form

PostPosted: Sun Sep 13, 2015 9:27 pm
by Bernd.N
Sounds like you use non-stored calculations.
cuoredisardegna wrote:Yes I need to recalculate all the record...

I would try to look at this assumption again, as that condition creates the problem. Try to remove the condition, then you do not have the problem any more. :)
When a table form should list records, sure there should not be any costly calculations go on at that point.
Maybe you explain why those calculations are needed.

Normally, all needed calculations could be done when a single record is created, even when you have to create more columns because you need (for example) some values in different currencies in parallel. And the fields/columns you do not want to show could be set to visible=false.
So everything you want to show could be calculated before, and not with costly calculated fields, I guess. Invoice data is fixed data, after creating an invoice, neither the invoice amount nor the invoice tax will change.