John W. Colby
jwcolby at colbyconsulting.com
Fri May 13 06:31:58 CDT 2005
>I start by saying no in principle. Precisely >OTOH the reverse may, in many cases, be true, i.e. that if a calculation changes existing records do want to be affected. Precisely >The other one time I go for YES is for speed. Yes, with a BIG but... If you are going to do this you must make sure you have a change flag that tells you if any of the data has changed, necessitating a new calculation. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey Sent: Friday, May 13, 2005 4:39 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Programming I start by saying no in principle. Then I look for exceptional circumstances. You mention Client Charge. To me that sounds like a Yes because the charging algorithm may change and if it does the new calculation should not affect previous billings. So that's one argument for storing a calculated value. OTOH the reverse may, in many cases, be true, i.e. that if a calculation changes existing records do want to be affected. That would be a sound argument for not storing those calculated values. The other one time I go for YES is for speed. If you are likely to have to, for example, select records where jobtotalhours>x then I'd certainly consider storing it. At the end of the day the system's for the benefit of a user. If you can improve the user's experience by giving him/her a quicker answer, and the penalty isn't too great, then I'd store it. Just make damned sure no-one can alter start or end without your program recalculating total hours. My 2 pen'orth Richard -- Andy Lacey http://www.minstersystems.co.uk --------- Original Message -------- From: Access Developers discussion and problem solving <accessd at databaseadvisors.com> To: AccessD <accessd at databaseadvisors.com> Subject: [AccessD] Programming Date: 13/05/05 07:56 > > Hi Group > > A general programming question. Would you ever store calculated > values in a table. My example is this... > > I have a Timesheetline table recording jobstart, jobend times/dates > etc. Do I store jobtotalhours in the table and do I store Client > charge and EmployeePaid amounts. I would not normally store > calculated values in a table but as these calculations are quite > complex (different charge rates, time periods e.g std and overtime > etc) I thought that once calculated (at the point of data entry) why > not store these values in table (may improved report > speed/programming). Alternativley, isn't this what computers are for > ie carrying out complex calculations so why store value, when it comes to reporting on or > displaying etc simply recaculate. My leaning now is not to store these > values. Any thoughts? > > Richard > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > > > > > ________________________________________________ Message sent using UebiMiau 2.7.2 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com