summation of field values

For HanDBase related topics that are not specific to one platform.

summation of field values

Postby mpanat » Sat Mar 18, 2017 1:52 pm

I wish to create a database where a patient tracks the number of bags of fluid used out of a total supplied to him . There are three kinds of fluids, 1.5%, 2.5% and 3.5%. He may have been supplied about 30 bags of each. He is expected to use 1-2 bags of each fluid per day. I have been frustrated in creating a calculated field that has the running total of each type of bag used . I then need to subtract this from the total supplied and then to have a pop up message when the numbers fall below say 5. There does not seem to a summation function in the function expression.
I hope this is not a repeat of what has already been asked, many thanks for any help in this.
Posts: 1
Joined: Fri Aug 16, 2013 8:08 pm

Re: summation of field values

Postby ddhsoftwareadmin » Fri Jun 09, 2017 7:59 pm

Hi there,

I want to first say I'm very sorry it's been about 3 months since you posted and I'm just answering now. I usually do better than this and I really missed out big time. I hope you have found a solution by now and I'm very sorry again.

Regarding your question, there isn't a simple summation like a spreadsheet where you can specify a range of fields to sum. You can always add them manually (ie, Field 1 + Field 2 + Field 3, etc), and if you're meaning to sum more than 6 fields, you'd have to daisy chain some partial calculations together. For example if you want to sum 8 Fields (eg, Fields 1-8) you can do the following:

Field 9= FIeld 1+ Field 2 + Field 3 + Field 4 + Field 5
Field 10 = Field9 + Field 6 + Field 7 + Field 8

and now field 10 has your sum.

If you want to sum multiple records you can do running totals of each Field by adding the previous calculated value to the current field. For example if you want to sum Field 1 across all related/filtered records, you can do the following:

Field 2 = Previous Field 2 + Field 1
this will give you a running total of Field 1 across all fields within the filtered range (which, if you're using a linked/link relationship could be just the relevant records for that patient).

Let me know if you have any further questions- I promise I'll answer more quickly.
Site Admin
Posts: 448
Joined: Tue Dec 09, 2008 2:13 pm

Return to HanDBase General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests