Calculation FIelds Do not Appear in The Form

Questions, tips and tricks and techniques for scripting in Servoy

Calculation FIelds Do not Appear in The Form

Postby cuoredisardegna » Wed Sep 09, 2015 4:19 pm

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
cuoredisardegna
 
Posts: 68
Joined: Mon May 07, 2012 5:34 am

Re: Calculation FIelds Do not Appear in The Form

Postby jdbruijn » Wed Sep 09, 2015 5:03 pm

Take a look at databasemanager.recalculate()
But do you really need that many records updated at once? Seems like a bit much to me.
Jos de Bruijn
Focus Feedback BV
Servoy Certified Developer
Image
jdbruijn
 
Posts: 492
Joined: Sun Apr 11, 2010 6:34 pm

Re: Calculation FIelds Do not Appear in The Form

Postby cuoredisardegna » Wed Sep 09, 2015 5:26 pm

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
cuoredisardegna
 
Posts: 68
Joined: Mon May 07, 2012 5:34 am

Re: Calculation FIelds Do not Appear in The Form

Postby mboegem » Wed Sep 09, 2015 9:17 pm

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
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Calculation FIelds Do not Appear in The Form

Postby Bernd.N » Sun Sep 13, 2015 9:27 pm

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.
Bernd Korthaus
LinkedIn
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Bernd.N
 
Posts: 544
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany


Return to Methods

Who is online

Users browsing this forum: No registered users and 11 guests