Asset ID parsed as string not number to nested Asset Listing


(paul walker) #1

Matrix version 6.33.0

Hi Folks

In a component’s metadata schema I have a field called “target_asset”

I am nesting an Asset Listing in the Components Paint layout and trying to parse the value of “target_asset” to that listing using additional get paramaters.

I think that the variable must be parsing “target_asset” as a string rather than as a number as “%asset_metadata_target_asset^as_asset:asset_name%” does NOT return the name of the asset in the Asset Listing.

However, %asset_metadata_target_asset^as_asset:asset_name% used in the paint layout DOES return the asset name.

I assume that I either need to ensure that the value being parsed is a number OR convert the parsed value from string to number in the Asset Listing

I have tried various ways to achieve this but have been unsuccessful hence I am posting here in the hope that someone can assist

Any help would be greatly appreciated

paul


#2

Hi @paul if I understand your questions correctly, it doesn’t have anything to do with being parsed as number of string.

In a component, when you work on the paint layout then the asset in keywords refers to the asset where the component is applied. If you nest an assets listing in the paint layout, when you use keyword in type format of the assets listing for example, the asset in keywords refers to the actual asset being processed in the listing. So if there are 10 assets to be listed, the asset in keywords in the type format refers to each of those 10 asset.

I hope I get the question correctly and it helps.


(paul walker) #3

Hi QL
Ah - sorry - I did not make my issue clear (my bad). Indeed, the asset listing functions exactly as it should but I separately wish to target on of the (10) assets to display it on the ‘Page contents’ of the listing

The “Type formats > default format” (listing) is fine

So, using your 10 assets analogy, I am trying to target just one of those assets to display it’s name and other attributes on the “page contents”

Not sure if this has made it clearer or muddied the waters - but thank you for your help anyway :slight_smile:
p


#4

You don’t access to the listed assets in the Page Contents. Common keywords (i.e. not global keywords) used in the Page Contents will refer to the assets listing itself. For example, if you do %asset_name% then you will see the name of the assets listing asset.

If you need to display information about one of the 10 listed assets, it will depend on how the logic used to determine which one of those assets will be used. One way to achieve that is to create an extra metadata field in your component’s metadata schema. The field type will be related asset. There you can choose which asset of the listed assets to be used.

Then you need to pass on this selected asset from your component’s paint layout to your assets listing asset via get parameter.

Paint layout

You can use nested asset in your Type Formats to nest your assets listing, Click Show additional settings, and add additional GET parameters. For example, let’s say you use variable name listx and your variable value will be %asset_metadata_your-chosen-asset% %globals_asset_metadata_your-chosen-asset%.

Assets listing

In your Page Contents you can get the value using %nested_get_listx%.

Hope that helps.


(paul walker) #5

Thank you once again for your help.
I have been using the method you have suggested here but when I use %nested_get_listx^as_asset:asset_name% it does not return the name of the selected asset nor can it therefore access any additional metadata associated with the selected asset - that is my dilemma

The extra metadata field is exactly as you have suggested so that I can highlight one of the listed assets on the ‘Page contents’ of the listing.

Tricky one - I suspect it is me doing something daft or just missing something

thanks again
p


#6

I see …

I have updated the Paint layout section in my comment above. Try use global keyword for the variable value.


(paul walker) #7

Genius - if I were there I’d buy you a coffee

Thanks for all your time

p