The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Sum two or more values of the same field in frm-stats

Labels

This Discussion is public

Notifications

I need to get the sum of two or more values in the same field, to display in a view.

For example, I get this two values (67 is a dropdown field) in two cells of a table:

[ frm-stats id=66 type=total 67="Food" ] [ frm-stats id=66 type=total 67="Drinks" ]

But I want to put in another cell a combined value of those two, something like:

[ frm-stats id=66 type=total (67="Food" + 67="Drinks") ]

and that obviously doesn't work.

But what would the approach be?

Have you tried using a hidden field on your form to save the value?

No, I couldn't do that. I want to sum two or more results of frm stats from different dropdown values, but those are dynamic and I want to group them in different subcathegories, example:

Month total: [ frm-stats id=66 type=total ]

Food: [ frm-stats id=66 type=total (67="Suplies" + 67="Drinks" + 67="Groceries") ]

Trips: [ frm-stats id=66 type=total (67="Gas" + 67="Hotel" + 67="Expenses") ]

Fixed expenses: [ frm-stats id=66 type=total (67="Cable" + 67="Energy" + 67="Rent") ]

And so on.

The sum of three results would be the Month Total.

I want to make sure I understand (and I have helped out on some hospitality stats, so I am somewhat familiar with this):

You get data regarding the monthly sales/purchases of supplies, drinks, groceries, etc.  I am assuming this data is entered via a form (say form #1)

Each sales/purchase category has a separate value. So there is a form (is this from #1 or another form?) says something like "Total supplies purchased/sold for the month: " xxxxx (where this field auto-magically shows submitted data from another form.)

Then you want to tally all of the items that are food related for that month and show those subtotals, then add together those subtotals to show the total for the month.

Is my understanding correct?

 

 

Well, the subtotals are not necessary to add it together, that amount is shown by the first frm-stats shortcode:

[ frm-stats id=66 type=total 64_greater_than_or_equal_to="2017-05-01" 64_less_than_or_equal_to="2017-05-31" ]

There is only one form. The month is not important, that can be obtained with the "greater" and "less" part of the shortcode.

In this case, 66 is the field for the expense amount. 64 is a date type field.

This shortcode (also valid) gives me the amount of expenses of May 2017, which complains with "Supplies" in the field 67, a dropdown type field:

[ frm-stats id=66 type=total 67="Supplies" 64_greater_than_or_equal_to="2017-05-01" 64_less_than_or_equal_to="2017-05-31" ]

I can substitute "Supplies" with "Groceries", "Drinks", "Gas", "Hotels", etc.

But what if I only want to obtain the total for Groceries + Drinks + Supplies? (excluding Gas, Hotels, etc.) to show them in a subtotal called "Food" (or whatever).

I can't do:

Food May 2017: [ frm-stats id=66 type=total 67="Supplies" and "Groceries" and "Drinks" 64_greater_than_or_equal_to="2017-05-01" 64_less_than_or_equal_to="2017-05-31" ]

So, what the approach will be? (I hope it's clearer now)

Discussion closed.