Posts: 31
Threads: 14
Joined: Mar 2009
Reputation:
0
Is it possible to somehow show the submission count (or quantity of submissions within that database table) within a field? For example...under the "Edit Submission" page of a certain form...could I create a field which displays the submission count?
Thanks!
Brian
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi Brian,
Hmm... you could do it with the Hooks Manager / Submission Pre-Parser I think...
But wouldn't every submission then have the same value for that field - and it would be updated for all records each time a new submission is added / deleted? That does seem awfully wasteful.
- Ben
Posts: 31
Threads: 14
Joined: Mar 2009
Reputation:
0
(Nov 9th, 2010, 9:00 PM)Ben Wrote: Hi Brian,
Hmm... you could do it with the Hooks Manager / Submission Pre-Parser I think...
But wouldn't every submission then have the same value for that field - and it would be updated for all records each time a new submission is added / deleted? That does seem awfully wasteful.
- Ben
Thanks for the response Ben. Its a client request that really doesn't make all that much sense to myself...but what the client wants...the client gets.
I ended up adding this directly to the core. It works...just not the route I wanted to take. Thanks again!
Posts: 40
Threads: 7
Joined: Mar 2009
Reputation:
0
I have a client that wants something similar... albeit not exactly. Is there an easy way to get the number of submissions by day, or month, or year and print this out somewhere else on a website automatically... maybe by crontab or something? One of my clients wants to be able to say something like, "X number of people have contacted us today, this week, this year, etc.," but I'm not sure how to go about pulling that information out of formtools and pushing it to another section of the site. Any ideas? Possible? Not worth it?
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hmm... interesting...
Probably the simplest solution would be install the Pages module and in it, create a PHP page that calls a core function to find out the number of results in a form, and View. For example, this would work:
PHP Code: echo "Form ID 7, View ID 10: " . ft_get_submission_count(7, 10) . "<br />"; echo "Form ID 42, View ID 50 " . ft_get_submission_count(42, 50) . "<br />";
However, that would require you to set up a View for each form that have a Standard Filter set to only return submissions within a certain date range.
Lastly, you'd need to add that page to the client's menu, so they'd see it when logging in.
This would certainly work!
- Ben
Posts: 40
Threads: 7
Joined: Mar 2009
Reputation:
0
(Nov 10th, 2010, 6:31 PM)Ben Wrote: Hmm... interesting...
Probably the simplest solution would be install the Pages module and in it, create a PHP page that calls a core function to find out the number of results in a form, and View. For example, this would work:
PHP Code: echo "Form ID 7, View ID 10: " . ft_get_submission_count(7, 10) . "<br />"; echo "Form ID 42, View ID 50 " . ft_get_submission_count(42, 50) . "<br />";
However, that would require you to set up a View for each form that have a Standard Filter set to only return submissions within a certain date range.
Lastly, you'd need to add that page to the client's menu, so they'd see it when logging in.
This would certainly work!
- Ben
Thanks, Ben! I'm actually thinking about something for a public display, however. Instead of the client logging into the admin area to see the totals, she wants to publish the information on the public facing site along the lines of, "already x people signed up today, this month, this year... etc."
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Ah, sorry Andy - I missed that. But the idea is still sound: all you'd need to do is include the API (/global/api/api.php) before calling that code. That will give you access to all the core functionality and that code I posted will give you the info you want.
Still, it's a pain having to manually create Views for each time period that you want stats on... hmm.
Let me know if the above works. If not, I could look into updating the API to add a "get stats" function or something.
- Ben
Posts: 40
Threads: 7
Joined: Mar 2009
Reputation:
0
Nov 13th, 2010, 4:44 AM
(This post was last modified: Nov 13th, 2010, 5:38 AM by moorezilla.)
Great! I will give this a try and report back the results/link!
am
This works! http://headlice.org/ftforms/stats.php
I may have found a bug with the views functionality, however. If I set the filter to be "show me all the submissions that have nothing in the comments section" I get a number less than the total number of submissions, which is probably correct. However, if I set the filter to be "show me all the submissions that do not have nothing in the comments section," I get the total number of submissions. Could this be an issue with a textarea being used in a filter? Basically, I'd like to be able to get all the submissions that HAVE something in the comments field, but setting a filter to "not equals nothing" for the comments field seems to just pull up all of them, despite this not being the case... hope that makes sense.
Edit: I've tried to demonstrate this here: http://headlice.org/ftforms/stats.php 224 is the total number of submissions, and there are definitely at least 12 or so with comments in the comments field.
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi Andy,
No, that sounds like a bug. You should get the exact opposite in each case. I've logged it as a bug here: http://bugs.formtools.org/index.php?cmd=view&id=263
Is this important for you to fix now? If so, no worries - let me know and I'll look into it. Otherwise I'll get it into 2.0.5.
- Ben
Posts: 40
Threads: 7
Joined: Mar 2009
Reputation:
0
2.0.5 would be fantastic! Thanks, Ben.
am
|