Page 1 of 1

Calculations of records.

PostPosted: Mon Jun 22, 2009 12:56 pm
by msoldera
I'm new by this forum, hello to everyone.
I need to make calculations between the same fields of different records; in particular, should I enter daily hours worked and have a monthly total of hours in the same form or even in a different database. Is it possible? Thank you....

Re: Calculations of records.

PostPosted: Mon Jun 22, 2009 3:05 pm
by dhaupert
Greetings and welcome,

This is indeed possible- there is a section in the calculation editor where you can take the value of the previous record. This 'previous record' is basically the one above it, within the current filter range and current sorted order. So you can pick the previous value of a field to add to the current field and that will give you a running total when used across the records.
Take a look at the Checkbook sample database as it's got a total in there.

To take the value from one database to another, you can use a relationship field, and then do calculations on that value.

Hope this helps!

Re: Calculations of records.

PostPosted: Mon Jun 22, 2009 3:42 pm
by msoldera
Thanks Dave..
I tried several times, but the formula calculates always just the sum of the previous record and what I'm recording, not the sum of all the records.
May depend on whether I select the number of hours worked and who worked from two popup fields?

I use the formula: Add Field + Prev Field (the field is "Hours")...

Re: Calculations of records.

PostPosted: Mon Jun 22, 2009 3:45 pm
by dhaupert
msoldera wrote:Thanks Dave..
I tried several times, but the formula calculates always just the sum of the previous record and what I'm recording, not the sum of all the records.
May depend on whether I select the number of hours worked and who worked from two popup fields?

I use the formula: Add Field + Prev Field (the field is "Hours")...



Thanks for the clues. Yes, it seems that you're just adding the prev value to the current value. What you need to do is add the previous total to the current value. So for example, point to the previous value of the calculation field itself and then add the current amount to it!

Hope that makes sense, but let me know if it does not.

Re: Calculations of records.

PostPosted: Mon Jun 22, 2009 3:56 pm
by msoldera
Yes yes yes.... :D I love this forum!

Thank you!!!

Re: Calculations of records.

PostPosted: Fri Jul 10, 2009 11:01 am
by nigelp
Hi

hello and apologies for jumping on this thread. I used the above solution to total an equipment check list where each item has a weight and the total weight is returned on the last item on the list. This I hope will keep a track of the bag weight as each item is added. Is there way to only total items in the list that a checked in the tick box field? I would like a list of all equipment and as items are selected the total inceases correspondingly.

Many thanks Nigel

Re: Calculations of records.

PostPosted: Fri Jul 10, 2009 11:42 am
by dhaupert
nigelp wrote:Hi

hello and apologies for jumping on this thread. I used the above solution to total an equipment check list where each item has a weight and the total weight is returned on the last item on the list. This I hope will keep a track of the bag weight as each item is added. Is there way to only total items in the list that a checked in the tick box field? I would like a list of all equipment and as items are selected the total inceases correspondingly.

Many thanks Nigel


Great question. here's how I would recommend doing it:

Make your running total calculation be: Previous Total field + (New Value to Add * checkbox field)
The checkbox field has a 1 or 0 value (1 if checked). So if it's not checked, it will be 0 and you'll effectively be adding 0 to the running total. If the checkbox is checked, you'll be adding the value in this record to the running total instead.

Hope that makes sense- let me know if it doesn't!

Re: Calculations of records.

PostPosted: Fri Jul 10, 2009 4:02 pm
by nigelp
Excellent Thankyou. I will continue playing about and see what else I can do with my list!! ;)