The current asset has a related metadata field that provides an array of IDs: %asset_metadata_related-interests% = [91456,91457]
We have an asset listing page (19689) that uses Dynamic Parameters to fetch an array of specific IDs from a GET Variable (GET Variable Name = relatedAssets).
In the current asset, we’re calling the asset listing page and passing the GET variable via a keyword string: %globals_asset_contents:19689^with_get:relatedAssets={asset_metadata_related-interests}%
This doesn’t return any results from the asset listing.
If we manually replace the modifier argument with the output of the keyword (ie - %globals_asset_contents:19689^with_get:relatedAssets=[91456,91457]% the asset listing returns the results for 91456 and 91457 as expected.
It seems that the modifier arguments aren’t being populated using the keyword string.
We’ve tried as many different combinations as we can, but with no luck. What’s missing here?
But all that is being rendered is {parent_contents} and not the contents of the parent asset.
In fact I am actually wanting to do %globals_asset_assetid^neq:{parent_assetid}:{parent_contents}:%
In order to aviod recursion.
Printing %globals_asset_assetid% and %parent_assetid% - in the Group Level bodycopy returns the values I expect.
But somehow using a keyword modifier within the same body copy fails.
Should Keyword Replacement Values as Modifier Arguments be available as keyword replacements on asset listings?
This won’t work because the {asset_metadata_related-interests} part is referring to the globals context of the keyword it’s used in, in this case it’s asset 19689, which is not where the metadata is at.
You’ve got 2 other options that I can think of:
Use a nested content container instead of the Globals keyword.
But ultimately it depends on the greater context of your implementation. Can you share some more info about where you are wanting to print this? In a PL that is applied to the asset that has the related metadata field? Is that asset that you are viewing on the frontend the asset that has the metadata?
But you might as well be able to use SSJS for this?
But again, can you explain the scenario a bit more? Are you trying to print the parent asset contents if the frontend asset’s assetid is not equal to some hardcoded asset ID value? (Assuming you are grouping by parent asset’s as well that is?)
The context is pretty basic. We’re using asset lists to create a REST JSON API using data withn Matrix.
In this instance we have a course record that can have one or more “related interests” that we want to print as an array within the individual course endpoint. For example:
We’ve actually managed to get around it by using embedded assets (see below), but we’d like to be able to avoid this so that we can use conditional keywords within the bodycopy (%begin_interests_are_present% print the intrests array %end_interests_are_present% etc).
But you could go simpler and also try to just use %globals_asset_contents_raw:19689% by itself and in the asset listing just use a dynamic set value of %frontend_asset_metadata_related-interests% as the value to source asset IDs to list from? That would work if the asset on the frontend request is the actual asset that has the metadata value for the related assets to list data from.
We’re on the list to upgrade to 5.4.2 but need to get our SSO house in order first! Very much looking forward to %asset_data% - it’ll help us with a bunch of stuff.
This works , but a question: why are the first and last % marks separated in the print statement? I can see that the print call doesn’t work if they’re not broken out - but why does that make a difference?
Yea, global keywords are processed first, so you need to separate them out in order for matrix to not try and process it prematurely, because you want the JS to run first, then the keywords. .