Count number of submissions in week


(Pomster09) #1

Hi guys,

 

Still planning an admin dashboard to control form submissions for custom form I'm working on.

 

I'm thinking I'd like to display some charts on that dash, maybe of submissions per week, submissions per region, most common issues.

 

I could easily use flotcharts or google charts, to plot the data and draw the charts. The hard part is what can I use on the Squiz side of things to count the numbers?

 

A simple explanation for the submissions per week. I can maybe show a line chart going back 12 weeks, then get Squiz to calculate those numbers for every 7 days.

 

Simple yes?

 

But how simple? 


(Nic Hubbard) #2

A simple explanation for the submissions per week. I can maybe show a line chart going back 12 weeks, then get Squiz to calculate those numbers for every 7 days.

 

Simple yes?

 

But how simple? 

 

How are you needing this data formatted?


(Bart Banda) #3

Matrix wise, you could probably achieve the date range filtering and display using a search page asset. Just set it to search form submission assets and set the search field to target created date. 


(Pomster09) #4

Thanks Bart, I set up a search for my form, but couldn't get any results. Quite frankly I wouldn't even know where to start. Is there a tutorial of any sorts knocking around that goes into using search on form submission?

 

Would be great if I can use the search not only for printing a count, but also for searching data from the other fields in the form.

 

Cheers


(Nic Hubbard) #5

Matrix wise, you could probably achieve the date range filtering and display using a search page asset. Just set it to search form submission assets and set the search field to target created date. 

 

Are Form Submission assets even indexed?


(Bart Banda) #6

Yep,they are indexed, but you can't search on form fields unfortunately. You would have to have a trigger (or possibly form submission action) that sets metadata fields on the form submissions asset with values from the actual form fields on the submission. 

 

I don't think there is any tutorial on it as it's not very commonly used, but you can follow the simple example in the manuals (http://manuals.matrix.squizsuite.net/search/examples/example-search-page) and maybe go from there.

 

To make sure you get any results at all, you can start with making sure the search fields screen has the setting of Allow empty searches set to Yes and do an empty search on the front end to confirm that the search page will bring back anything at all. 


(Pomster09) #7

Oh, I have another thread I started, asking if there's a way of creating a new data record each time a form is submitted, it would be great if I could create something that can be indexed. If anyone else has worked on this before I'd love to see a sample, otherwise I'll just have to knuckle down and learn triggers. Cheers


(Bart Banda) #8

You would have to do the same thing with a trigger, so a trigger when a form submission asset is created, create a data record and set some metadata. It might be easier and cleaner to just set the metadata on the form submission rather than having to create another asset for each form submission asset. 


(Pomster09) #9

Thanks Bart, so correct me in the process if you could.

 

1) Create a new meta data schema

2) In each metadata field I'd place the keyword for the form field response?

3) create a trigger that listens for the submission asset

4) somehow populate the metadata?

 

How do I apply the schema in the first place, or would the trigger apply the schema?


(Nic Hubbard) #10

Thanks Bart, so correct me in the process if you could.

 

1) Create a new meta data schema

2) In each metadata field I'd place the keyword for the form field response?

3) create a trigger that listens for the submission asset

4) somehow populate the metadata?

 

How do I apply the schema in the first place, or would the trigger apply the schema?

 

So, you are not able to use an Asset Builder here?


(Pomster09) #11

I don't think it's feasible to use an asset builder. The form will be used by about 260 organisations, and has around 50 fields.

 

There's over a 100 of them submitted per week, so after a very short period there's going to be lots of data. That's why I'd like a dashboard showing not only results, but some charting as well. I'd love to be able to manipulate the data at some stage too.


(Bart Banda) #12

I don't think it's feasible to use an asset builder. The form will be used by about 260 organisations, and has around 50 fields.

 

There's over a 100 of them submitted per week, so after a very short period there's going to be lots of data. That's why I'd like a dashboard showing not only results, but some charting as well. I'd love to be able to manipulate the data at some stage too.

 

An asset builder would actually be able to do all of this, and a lot easier as well, especially with the metadata. You will still end up with the same amount of data if you use a custom form because each form submission is an asset. The downside with the asset builder is the sending of the emails, you would have to do it with a trigger. So send email after asset built.

 

However, if you must use a custom form, then you could apply the metadata schema to the form submissions folder where the form submissions come in. That way any new ones would automatically inherit the schema.

 

I'm not sure if you can put default values in the metadata fields as the form respone keywords, would have to try it out. If not, then you would have to have a trigger action for each metadata field you want to populate. So with a trigger, set the event to asset created, set the conditions to only apply to your submissions root node and for form submissions assets. Then the action would be set metadata value, and you would have to have one for each form field you want to capture or search on.

 

So as you can see, it's harder to use a custom form asset and trigger to set metadata, and easier to just use an asset builder and use a trigger to send the emails (if you even need to send any emails). The asset builder could just create data source assets. And you can still search on these and filter by creation date ranges etc.


(Pomster09) #13

The form is actually finished and took me about two weeks to create due to lots of javascript and jquery interaction, such as one selection depends on other selections. Loads of CSS/Jquery show /hide stuff. It has to be live by 30 June 2013 and needs to go to user testing this Friday. I know I don't have the time to re-create all the logic with the javascript and make the form look presentable in such a short period of time. Plus how does an asset builder handle things like mandatory/non-mandatory fields, and correct email format validation? I'd probably have to use some custom validation too. Just seems like such a big job to do a simple thing, especially seeing as I've already spent way too much time on it. I may give the trigger a go, and only create metadata fields for the vital stuff that the admin panel needs for it's searching and charting. Then in a main table on the admin panel I can just use an asset listing to create a sortable table. Thanks anyway guys.


(Joel Porgand) #14

Search pages are probably the way to go, but with 100 submissions a week, going over 12 weeks you might run into some speed issues - pulling out 1200 assets isn't super fast. You might want to look into caching data with localStorage (http://diveintohtml5.info/storage.html) to cut down on loadtimes, then just pull in submissions since the last loadtime.

 

As far as presenting the data goes, your best bet might be chopping it up clientside - setup your search page to return JSON to you, then plot it with something like jqPlot - http://www.jqplot.com/.


(Pomster09) #15

Ok so I set up a metadata schema and applied it to the folder, this then attaches itself to the submission. I can see these when I created an asset listing.

 

I'm also trying to get a trigger to post the values on the from fields into the metadata, as per Bart's idea; though I'm not have any success. Effort so far is below, any ideas? (the trigger is enabled)

 

trigger1.jpg


(Nic Hubbard) #16

Is the Trigger Manager turned on?  Do you need that dynamic parameter on the Set Metadata Value action? If not, try removing it.


(Pomster09) #17

The trigger manager is on Nic, I'll also try removing that dynamic parameter if you think it may help.


(Pomster09) #18

I tried that Nic, didn't make any difference.


(Nic Hubbard) #19

How about trying to check that "Use Default" option. Sometimes those triggers take a bit to get working.


(Bart Banda) #20

Also make sure that "Replace keywords in the set value" is checked.