This is a tip which I've found very useful. I hope it's useful to you too.
If you have external systems which you need to present data from there are four ways which I'm aware of in Matrix:
- Remote Content asset, which passes through data
- Data Source assets (database, csv etc), which request on demand
- Import scripts, which update assets in batches
- and Web Services, of which I know nothing
I've found the import XML script very useful.
Here are two ways using it:
- wget or curl an API feed from source system. Transform it using XSLT into the import script syntax. Run import script from command line or from within Matrix. Source data can be any structure markup: XML, XHTML, RSS etc. HTML can be used but consider running it through Tidy first.
- get some tabular for import. Get list of assets from Matrix using Asset Listing asset. Munge both tabular lists together and wrap in XML tags. I prefer using VLookups in Excel/LibreOffice Calc. If you have the AssetId from Matrix in one column and the new value in the next then you have nearly all you need.
I've used the above methods for:
- a one-off for updating metadata on 200 profiles
- as a daily update from a central store of person profiles
- a one-off for updating usernames of 100 people to follow new login system
Don't be daunted by XSLT. It's a really useful language. I found oXygen XML editing software, Saxon transform engine and the O'Reilly book XSLT by Tidwell were a winning combination.
My only complaint about this script is that the syntax is not elaborated in the documentation. A bit more documentation would be helpful.
How that's useful,