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

Multiple fields for frm-stats

Labels

This Discussion is public

Notifications

Hello,

I created a support ticket but not sure if staff can help me out because this involves some custom code so i wanted to see if the community can help me out. i currently have a shortcode setup for my view which adds the total of all entries of a specific field (total hours) based on the search parameter company. the code is  {frm-stats id=596 type=total 604_contains="{get param=company}"}. (had to replace with braces because brackets was trying to execute the code in the post)

i want the ability to not only filter this total by company but also by an end date and start date. my search form already has parameters startdate and enddate which work great but not sure how to put all three in the stats shortcode. i was referenced to a custom code here but not sure how this will work for me. can someone give me some guidance?

 

Thanks in advanced!

The code to which you were referred is to build your own shortcode. In the example, the shortcode is named 'if_get_param', but you can name it anything you want. Since you are building your own shortcode, you can add as many parameters as you'd like, including the dates. The parameters are passed to your shortcode function in the $atts array. You would also have to write your own SQL query to use those parameters. I would probably search Formidable's source to find the frm-stats code and use that as a starting point for your own custom shortcode function. Even with a headstart, this could probably take about a day to build and test thoroughly. It is definitely advanced coding.

Would someone be willing to point me into the right direction or give me a sample of this?

You've already been pointed in the right direction. The example shortcode you referenced in the original post is your coding template. All the code for the current frm-stats short code is in /pro/classes/controllers/FrmProStatisticsController.php.

Providing another coding sample beyond what's already been provided would require writing the function for you. That's way beyond the scope of what I can provide as a community volunteer. If this level of coding is not within your skill set, please consider hiring a developer.

Thanks Victor but i figured out what i wanted by myself. There was no custom code needed. Please see the code below so you can understand what i was trying to do.

 

[frm-stats id=596 type=total 604_contains="[get param=company]" and 553_greater_than_or_equal_to="[get param=startdate]" and 553_less_than_or_equal_to="[get param=enddate]"]

Basically the three shortcodes work great independently so you can add 'and' in between each function to include them. so it looks for anything with the given company name within the two dates and adds the total together.

Wow! That's great. I wish I could have been more helpful. I should've read through the code more deeply.

Just to finalize this thread, Laura over on the support forum advised me that the formidable short codes already include 'and' so you can just add them together without it. So anyone needing something like this, jus put the different short codes together.

Thanks.

Discussion closed.