Pass a date variable into an asset listing


(Glovegro) #1

I have created an asset listing that lists completed form submissions. Then, using the %asset_short_name_linked%  gets output as a CSV file.

 

All works well and as expected - however, I would like to limit the submissions by a specified date (e.g., only output submissions newer than 1 Aug 2016)

 

How can I pass a 'date' form field value into the code below (replacing the hard coded value I have there currently)?

 

%globals_get_<variable>% does not seem to work.

 

Type Format > Default Format (as below):

%begin_asset_created^gte_date:2016-04-15% %asset_created%,"%question_answer_293980_q1%","%question_answer_293980_q2%","%question_answer_293980_q13%","%question_answer_293980_q4%","%question_answer_293980_q5%","%question_answer_293980_q9%","%question_answer_293980_q11%","%question_answer_293608_q1%","%question_answer_293608_q2%","%question_answer_293608_q13%","%question_answer_293615_q1%","%question_answer_293616_q9%","%question_answer_293616_q2%","%question_answer_293617_q2%","%question_answer_293617_q4%","%question_answer_302006_q2%","%question_answer_302006_q3%"
%end_asset%

Running Windows with Chrome

We are using Squiz v5.3.4.0

 

Any assistance would be much appreciated.

Gavin


Comparing a metadata value to a Get query string value
(Bart Banda) #2

You are probably better off doing this with a search page and passing a start and end date search value to it to only list the form submissions you need. You could search for the created date value for example to filter them by date.

Have a look at https://matrix-manuals.squiz.net/search/chapters/search-page

 

Alternatively, if you want to stick with what you have, if you are passing the date value via a GET URL parameter, you could do something like:
%begin_asset_created^replace_keywords:gte_date:{globals_get_date}%...


Comparing a metadata value to a Get query string value
(Glovegro) #3

Thanks Bart,

 

I have tried %begin_asset_created^replace_keywords:gte_date:{globals_get_from}% ....

 

'from' being the GET URL var being passed in ... but no success (see below):

 

Trying to achieve all results that are greater than a passed in GET URL variable ...

 

%begin_asset_created_short^replace_keywords:gte_date:{globals_get_from}%

"%asset_created_short%","%question_answer_297326_q1%","%question_answer_297326_q2%","%question_answer_297326_q3%","%question_answer_297326_q4%"

%end_asset%
 
Strange thing is, if I inject %globals_get_from% into one of the CSV columns (as below) it parses and outputs it correctly.
 

%begin_asset_created_short^replace_keywords:gte_date:{globals_get_from}%

"%asset_created_short%","%question_answer_297326_q1%","%question_answer_297326_q2%","%question_answer_297326_q3%","%globals_get_from%"

%end_asset%
 
Can you see anything I am overlooking?
 
Many thanks in advance
Gavin
 
 

(Bart Banda) #4

Yep, you're right, I can replicate the same issue. Smells like a bug to me, I'll see if I can get a developer to review and investigate. 

 

In the meantime, you would be better off using a search page to filter the list instead and pass your date range to that so that you don't even print or generate the assets you don't want to.