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
Multiple fields for frm-stats
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!
July 10, 2017 at 9:36 am
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.
July 10, 2017 at 11:57 am
Would someone be willing to point me into the right direction or give me a sample of this?
July 10, 2017 at 12:12 pm
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.
July 10, 2017 at 12:51 pm
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.
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.
July 10, 2017 at 3:58 pm
Wow! That's great. I wish I could have been more helpful. I should've read through the code more deeply.
July 11, 2017 at 6:39 am
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.