Calculations of records.

Discussion of the version of HanDBase that runs on the iPhone and iPod touch devices. This includes the synchronization conduits as well.

Calculations of records.

Postby msoldera » Mon Jun 22, 2009 12:56 pm

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....
msoldera
 
Posts: 10
Joined: Sun Jun 21, 2009 2:50 am

Re: Calculations of records.

Postby dhaupert » Mon Jun 22, 2009 3:05 pm

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!
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Calculations of records.

Postby msoldera » Mon Jun 22, 2009 3:42 pm

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")...
msoldera
 
Posts: 10
Joined: Sun Jun 21, 2009 2:50 am

Re: Calculations of records.

Postby dhaupert » Mon Jun 22, 2009 3:45 pm

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.
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Calculations of records.

Postby msoldera » Mon Jun 22, 2009 3:56 pm

Yes yes yes.... :D I love this forum!

Thank you!!!
msoldera
 
Posts: 10
Joined: Sun Jun 21, 2009 2:50 am

Re: Calculations of records.

Postby nigelp » Fri Jul 10, 2009 11:01 am

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
nigelp
 
Posts: 38
Joined: Fri Jul 10, 2009 3:51 am

Re: Calculations of records.

Postby dhaupert » Fri Jul 10, 2009 11:42 am

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!
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Calculations of records.

Postby nigelp » Fri Jul 10, 2009 4:02 pm

Excellent Thankyou. I will continue playing about and see what else I can do with my list!! ;)
nigelp
 
Posts: 38
Joined: Fri Jul 10, 2009 3:51 am


Return to HanDBase for iPhone and iPod touch

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron