Searching against "submitted" Asset Attribute of Form Submissions


(Jamie Smith) #1

Hello. I have a Search Page to allow Form Submission assets to be searched based on a date range. In the Search Fields screen I'm targeting the submitted Asset Attribute. Doing so prompts input fields to appear in the UI (via the Data Source keyword replacement). However, upon running the search based on a "From" and "To" date, no results are returned.
The submitted attribute value is in the format, e.g., "2016-01-20 22:30:19". However, the "From" and "To" input fields printed by the keyword replacement in the Initial Search Page Layout bodycopy don't include fields for the "h:i:s" portion of the submitted attribute value, and I wonder whether this is causing the problem of no results being returned.

In the HTML that Matrix spits out, I notice that there are eight hidden fields with the following names|values:

  • queries_test_query_fromshow | ymd
  • queries_test_query_fromvalue[h] | --
  • queries_test_query_fromvalue[i] | --
  • queries_test_query_fromvalue[s] | --
  • queries_test_query_toshow | ymd
  • queries_test_query_tovalue[h] | --
  • queries_test_query_tovalue[i] | --
  • queries_test_query_tovalue[s] | --

I've amended the values of the "h:i:s"-specific fields to "00", and the other two to "Y-m-d H:i:s", and have submitted the form to no avail.

Form Submissions are being indexed, and I'm able to search on other Asset Attributes (such as current_page).

Does anyone know whether it's possible to tweak the form to send the data in a format that Matrix will be able to use to search against the submitted attribute?

Any advice appreciated :-)

Cheers

 

Version: Matrix v4.14.1


(Jamie Smith) #2

Are there any Matrix devs on here who might be able to comment?

 

I'm creating a CSV file for the client which combines Custom Form user responses and metadata associated with each submission. Being able to search against the submitted date is pretty important in being able to get it to work optimally. Any help would be appreciated :-)


(Edison Wang) #3

The "submitted" attribute is not indexed by Search Manager because it's not "enabled" to be accessible, via keyword system, search system or any other Matrix methods.

 

If you are familiar with Matrix code, in the form_submission_management.inc here defines this "submitted" attribute.  you will have to add a "'is_admin'    => FALSE,", and then run install step 3, so that this attribute will be opened to be accessible.

 

In this case, can you just search on the "created date"? that's a standard asset property, every asset should have it. it should be same as "submitted" date?


(Jamie Smith) #4

Many thanks for getting back to me, Edison. That's useful information. The form is a relatively lengthy one, with a 'save for later' function, so creation and submission dates may be different. I've ended up using the JS API to fashion a solution, but the info you've provided may be useful in future.


(Bart Banda) #5

You could also set a metadata date value using a trigger whenever the form submission is completed and do searches on that perhaps? 


(Jamie Smith) #6

You could also set a metadata date value using a trigger whenever the form submission is completed and do searches on that perhaps? 

 

Thanks, Bart.