Summing data based on year

By: Joe Semones | Asked: 02/11/2025
ForumsCategory: How-toSumming data based on year
Joe Semones asked 1 week ago

I have a form which includes entries which occurred for an event in 2024. Using frm_math I was able to get a count of entries related to different values in a field.  Here's an example of the code in the Edit Listing page content:

<strong>Registration Count:</strong> [frm-stats id=68 type=total] <strong>
Registrations by Decade</strong>
1941-1950: [frm-math][frm-stats id=72 type=count 72="1941-1950"]+[frm-stats id=80 type=count 80="1941-1950"][/frm-math]
1951-1960: [frm-math][frm-stats id=72 type=count 72="1951-1960"]+[frm-stats id=80 type=count 80="1951-1960"][/frm-math]
1961-1970: [frm-math][frm-stats id=72 type=count 72="1961-1970"]+[frm-stats id=80 type=count 80="1961-1970"][/frm-math]
1971-1980: [frm-math][frm-stats id=72 type=count 72="1971-1980"]+[frm-stats id=80 type=count 80="1971-1980"][/frm-math]
1981-1990: [frm-math][frm-stats id=72 type=count 72="1981-1990"]+[frm-stats id=80 type=count 80="1981-1990"][/frm-math]
1991-1998: [frm-math][frm-stats id=72 type=count 72="1991-1998"]+[frm-stats id=80 type=count 80="1991-1998"][/frm-math]
<br>

A user's entry would be captured in only one of these buckets and the result would look like this:
Registrations by Decade
1941-1950: 0
1951-1960: 1
1961-1970: 20
1971-1980: 38
1981-1990: 3
1991-1998: 2

Now in 2025 using the same form with the (hidden) Year field changed to 2025, I changed the filter to capture only entries from 2025, but all entries are being counted. Evidently the Year=2024 in the view filter had nothing to do with the above calculations. If I am not doing a math calculation, the list of registrations for 2025 is shown correctly.  

How do I get the form math to honor the filter, or how do I cause the math to limit the scope to entries for a given year?

Bobby Clapp Staff replied 1 week ago

Questions/Clarifications needed:

Is Registration Count:</strong> [frm-stats id=68 type=total] relevant to anything at all in this scenario?

Fields 72 and 80 are presumably radio fields where you are counting the number of entries selected for each radio field and then adding them together?

The hidden field with the year. That exists in every entry where you've selected a year range and every entry has the correct year listed for the reflected entry, yes?

If your filter says "hidden year field" is equal to a static value of 2024, it would or should respect only showing the math values for entries where that value is 2024. If you change that to 2025 you should have different math results.

Can you share some screenshots and/or link to the page where all of this is?

Joe Semones replied 1 week ago

Bobby,
Did you see my reply? Let me know if I should send it again.

Joe

Joe Semones replied 1 week ago

I've provided another answer but am not able to see the what I've provided.

Victor Font Staff replied 1 week ago

Joe,

Your answer to Bobby's question came through email. I'm posting it here for all to see:

"Is Registration Count: [frm-stats id=68 type=total] relevant to anything at all in this scenario?
[68] captures the number of registrants for this entry, 1 or 2, so it\'s rather a check total when we go about capturing the details counted in fields 72 and 80.Fields

72 and 80 are presumably radio fields where you are counting the number of entries selected for each radio field and then adding them together?
72 and 80 are drop downs, not radio fields, but you have the right idea.

The hidden field with the year. That exists in every entry where you\'ve selected a year range and every entry has the correct year listed for the reflected entry, yes?
Yes. For clarification, the field name is really \"ReunionYear\".

If your filter says \"hidden year field\" is equal to a static value of 2024, it would or should respect only showing the math values for entries where that value is 2024. If you change that to 2025 you should have different math results.

I've attached shots of the relevant entries and views. I will provide more if needed.

Thanks for your help.

Joe"

Bobby Clapp Staff replied 1 week ago

I didn't get the shots here. Those would be helpful.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right