Need to filter shadow assets


(M L Sanders) #1

Using 4.18.2

 

I've got an XML Data Record that is pulling in a feed and creating shadow data assets.

 

I need to create standard page assets that will pull in info from a subset of these Shadow Assets - the selection will be based on the value of one of the attributes (course id).

I'm quite happy to use metadata in the page assets that will equal a Course ID stored in the Shadow Asset if necessary.

 

Here are my issues:

  • Although I can use an asset list to traverse the shadow assets, and the attributes are succesfully accessed and printed, I can't use this to filter the assets as asset lists don't support this;
  • Search pages don't seem to function if they're searching shadow assets - not returning any results (and they're really slow anyway);
  • Is there any way of using the Dynamic Input capability of XML Data Records to create and use these assets on the fly? Doesn't really sound feasible, I know....

Is there another way I'm missing that anyone could suggest?

 

I don't think it's practical to create a new XML Data Record for each distinct Course ID....

 

many thanks if you read this, let alone answer!!

 

mark


(Tim Davison) #2

I don't have access to test anything out just now, but this may help get in the right direction.  I think XML Data Source should have a filter section (manuals indicate it is so).  So set up the filter so it filters by course ID, I'm guessing you can use XPath.  Next part is adding the course ID as one of the dynamic parameters of the XML Data Source.  Dynamic parameters is nested into the filter/query/XPath so the output each time can change based on what value you supplied (in thsi case course ID).  You can probably pass it either as a nested get variable if you nest the asset listing somewhere, or else as a URL arg.

 

I've done similar to great effect with and LDAP data source - was using ajax to make the call and display the results, so I was passing the dynamic parameter in as a globals keyword.  I'd assume XML data source works very similarly.


(M L Sanders) #3

Hi Tim, Thanks for this.

Yes, I think there'd be no problem using the filter option and then passing in the course id value as a nested get variable.

But.....I might be missing something, but I'm not sure what happens if you simply nest an XML data source.

 

I thought that the XML data source simply produced shadow assets, which then had to be traversed with an Asset List (which would pick up the specific information required.)

 

Do you know if nesting the XML Data Source itself would actually return any data?

 

thanks agaian

mark


(Tim Davison) #4

No - you can't just nest a data source.  You need to create an asset listing and then point the asset listing to the data source.  Then you nest the asset listing into the page.  Took me a little while to get my head around that as well.  So - the way I look at it is whenever I'm using a data source I will always have 2 things - the source and the listing (or 'data' and 'presentation' layers for those who look at it like that).  Means it's also hard to check/debug the data source asset specifically.

 

(I think for an XML data source you can also use keywords to generate values based from xpath traversal so that may work, but I don't think this would be ideal for filtering).  Another option, quite specific to XML, is applying an xslt transform to it, but in post is sounded like you wanted dynamic, so I think this more lends itself to filtering.

 

You will find when you start using dynamic values in filters that all the shadow assets will in fact disappear from the asset map, which can throw people a little bit at first.  They will still be retrievable when the dynamic values are provided.

 

Development path I usually follow is:

1> Create a data source with the filters I want, with values hard-coded (shadow assets will appear in asset map so I can double-check).

2> Create an asset listing to list the results from the data source.  Assets listed should match the asset map shadow assets.

3> Change the data source filter to allow dynamic inputs (the shadow assets will now disappear from the asset map *and* the asset listing)

4> Modify the asset listing (or the way it's being called/nested) so that dynamic parameters are being passed in.  At this stage there will still be no shadow assets in asset map, but there *will* be results on the asset listing.

 

It can be tricky to wrap your head around, still feels a little bit of 'magic' to me.  There's a part that seems like it's 'in limbo' but it still works.


(M L Sanders) #5

Tim - I'll have a go with this in approximately 14 hours (obviously we're a bit behind the clock here in UK).

Many thanks; I'll let you know how I get on :)

 

mark


(Tim Davison) #6

Hehe - no worries.  I've done this with RSS, LDAP, and CSV data sources, never with an XML one, though it should be roughly the same.  Let me know how it goes.


(Bart Banda) #7

Have you tried using the Record Filter screen on the XML Data Source asset and passing dynamic filter values to it? http://manuals.matrix.squizsuite.net/data/chapters/db-data-source#Record-Filter-Screen 


(M L Sanders) #8

This has worked beautifully.

 

I didn't know that the GET parameter that can be passed when nesting an asset listing could, in effect, be passed through as a dynamic Record Filter in the XML Data Source. No I do know and IT WORKS!!

 

You guys ROCK. Thanks, Tim (and Bart).


(Tim Davison) #9

Glad to be of help.   :)   Yes, nesting and passing get parameters that way was an eye-opener (in a good way) to me as well.  Very useful.