CSV data source shadow assets keywords


(Nick Papadatos) #1

Matrix Version: 5.4

Hi squiz folk, not sure whether this is possible (couldn’t find anything on the forums) in regards to CSV data source shadow assets keywords other than the %ds_event_title% etc

I have a asset listing page
Default format: %asset_assetid^as_asset:asset_contents% (this works with actual asset)
Parameter: Array of specific asset IDs or selection group (specified assets must be children of the static related node)
get variable: “ids”

So what I’m trying to do (without having to create lots of actual assets) is use a CSV Data source and return shadow asset data based on the URL query i.e mysite.com.au/eventslit?ids=1,2,3,4

The rational is that the user can check which event/s they want to attend via a saved URL sent as an email.

Hope this makes sense
N


(Chiranjivi Upreti) #2

Hi Nick

I think you can use the Data Source asset’s Dynamic Inputs and Record Filter screen options to dynamically filter the records (Data Source’s shadow assets) in the output.

So in your case I believe you need to set up a Dynamic Input var with the GET Var “ids” as a source, and then use that value to filter the Data Source’s records in the Record Filter screen.

Check the manual https://matrix.squiz.net/manuals/data/chapters/db-data-source#Record-Filter-Screen for more details on the Record Filter options.


(Nick Papadatos) #3

Yep,I know all that thanks Upreti but what I’m trying to do is return more than 1 record see below another project I worked on using the dynamic input only returning a single record.

screen

my question is how to I return more than 1? i.e ?ids=1,2,3,4
what I have so far:

if I use match type > Regex ?ids=1|2 for example I get anything matching 1 or 2:
1,2,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,41,42,51,52,


(Chiranjivi Upreti) #4

Can you try below settings:

Record Filters
Value to Match: ^(%%ids%%)$
Match Type: Regex Match

Dynamic Variables - Data Mappings
Source: Set Value -> %globals_get_ids^explode:,^implode:|%

So above “Set Value” dynamic source will generate a regex string using your comma separated values in the “ids” GET var, which will be used for filtering (regex based) the records to the specified ids.


(Nick Papadatos) #5

PERFECT!
I think I was getting close in the record filters value to match - I was using ^([%%ids%%])*$ but didn’t realise to set the value in the dynamic variable data mapping.

This really helps thank you
N