Parent keywords array


(Anthony) #1

Way back in this post  there was a long discussion about whether there could be a keyword like %asset_parent_assetid% to find the parent of an asset. Greg gave a detailed explanation of some of the challenges where assets were linked in multiple places in the tree... what would you return? I chipped in a thought about returning a list of all of them hoping that might be a bit of help, and even suggesting a modifier to pull individual entries out of a CSV list.

 

Anyways... I happened to be refreshing my memory on the keyword modifiers manual page today when replying to another post and wow... what did I see but some cool new stuff from 4.18.3 to handle keywords that return whole arrays of values including ^index:n to grab a specific value, which can then have further modifiers applied. I must have somehow missed that exciting development when the release came out!

 

So... I know this has probably been debated more than once but dare I float the idea again... could it now be possible get that %asset_parent_assetids% and have it returning an array of ALL the linked parents of an asset - using whatever algorithm generates the list you would see on the linking screen. Once you accept the possibility that a keyword can return an array of values which we then have loads of cool modifiers to manipulate, I think most of the original challenges Greg's (and others) posted resolve themselves.

 

Thoughts, comments?

 

Anthony


(Nic Hubbard) #2

I doubt there will every be a generic keyword for this, but here is a solution to your issue. 

 

1. Create an Asset Listing with the following options set on the Details Screen:

 

Screen%20Shot%202014-07-24%20at%202.37.3

Screen%20Shot%202014-07-24%20at%202.37.4

 

2. Edit the Page Contents and add:

[%asset_listing%]

3. Edit the Default Type Format and add:

%asset_assetid%, 

4. Edit the Display Formats for the Asset Listing and add a new Customized List Position Format for position -1 (the last asset):

 

Screen%20Shot%202014-07-24%20at%202.40.1

 

5. Edit the -1 position and add:

%asset_assetid%

6. Finally, you can now use this Asset Listing as your keyword to list all of the parent IDs. So, if you have an asset that is linked in multiple locations, just add the following keyword to it:

%globals_asset_contents_raw:12345%

Obviously replacing 12345 with the asset id of the Asset Listing that you created.

 

7. Preview your asset that is linked in multiple locations and it should give you an output like this:

 

Screen%20Shot%202014-07-24%20at%202.36.4

 

 

The setup of the Asset Listing is really the only hard part, once that is done you can just use the globals_asset_contents_raw keyword to list the parents of an asset. You could even then use a keyword modifier on this.