Comma Seperated IDs work with SSJS?


(Tbaatar) #1

Matrix Version: 5.4.3.1

I’m following the related assets with SSJS tutorial and wanted to achieve something similar instead with an existing comma seperated ID’s in a single metadata text field but it doesn’t work.

Is this strictly for related metadata field use?

Thanks.
T


(Robin Bilney) #2

Could you use the ^explode modifier to split it into an array?

var assetIDs = %asset_metadata_your-metadata-field^explode:,%


(Tbaatar) #3

Hi Robin,

Thanks, it worked! :grinning:

I was trying json encode, decode, xml, array_values, array_slice and also tried the replace methods.