Using imported datasources like metadata?


#1

We have a bunch of variables in our site that we need to change frequently. Currently they are in metadata and we access them in pages with
%globals_asset_assetid:^as_asset:asset_metadata_<metadata_name>%

But we get the changes as a spreadsheet and I thought it would be much better to use that as a csv data source and use the data from that as variables directly.

I’ve got some shadow assets with all the data in them, but how do I actually use the data for anything? There are no instructions on the shadow assets page or the data source pages.


#2

I’m not sure if there is a way to access data source record set assets other than looping through them with an asset listing. A couple of ideas:

You could set a record filter on the key field of your data source, using a dynamic input eg a get parameter, and use ^with_get in your keywords to retrieve a value. No guarantees on performance.

Alternately, do the same thing with SSJS. Load in a JSON config file (or if it must be csv, try something like Papaparse) and print a value based on get parameter.

The other option would be to use the JS API to update the existing metadata fields (using html input fields to provide the csv).