Stored and unstored calculations...

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Stored and unstored calculations...

Postby IT2Be » Wed Feb 25, 2004 12:16 pm

I have been reading about stored and unstored calculations.

Can someone help me to get a clear picture on when and why to use either one or the other?

Also, when I have a calculation using 10 dataproviders (also using relationships) and something like 40 or 50 different conditions (also using relationships). Would I then use a calculation or is it better to use this as a method attached to the onDataChange event of the dataproviders that are subject to change and input for the calculation...

BTW I now use a method to do the trick...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Jan Blok » Tue Mar 02, 2004 5:01 pm

there are 3 reasons to use stored calcs:
1) calc function is very expensive, better store result for future use
2) sorting needed on calc results (this is not elegant, better prevent this)
3) external applications (like cristal reports) need access to calc results (like order total)
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby IT2Be » Tue Mar 02, 2004 5:02 pm

Thanks jan!
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Neale » Thu Mar 04, 2004 7:42 am

Jan Blok wrote:there are 3 reasons to use stored calcs:
1) calc function is very expensive, better store result for future use


Fair point. But how does Servoy know when the calculation needs to be redone (updated), without doing the "expensive" calculation?

Jan Blok wrote:2) sorting needed on calc results (this is not elegant, better prevent this)

Not sure I follow. Borrowing from your next example, is there an issue with wanting to sort on say order total?

Jan Blok wrote:3) external applications (like cristal reports) need access to calc results (like order total)


I.e. by storing the result of the calculation other apps don't need to know about the details of the calculation?

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby Jan Blok » Thu Mar 04, 2004 12:25 pm

1) calculations are at least (re)calculated if one of the imputs is changed
2) we leave sorting to the database so if something is not in the database it cannot be sorted.
3) yep
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 17 guests

cron