Picking up from here, I am now trying to streamline the process further. Instead of creating multiple variables, then combining together at the end to create the required output, I am trying to streamline the process where I can simply add folder numbers, and get the output. However output is giving me the string with each folder ID, instead of the output from the string.
See below:
var numbers = [123456, 234567, 345678];
var data = [];
for (let num of numbers) {data.push(`%globals_asset_children:${num}^json_decode^as_asset:asset_name,asset_assetid,asset_url,asset_published_short,asset_data_metadata,asset_data%`);}
// Show output:
print(JSON.stringify(data,null,2));
Example:
"globals_asset_children:123456^json_decode^as_asset:asset_name,asset_assetid,asset_url,asset_published_short,asset_data_metadata,asset_data", "globals_asset_children:234567^json_decode^as_asset:asset_name,asset_assetid,asset_url,asset_published_short,asset_data_metadata,asset_data", "globals_asset_children:345678^json_decode^as_asset:asset_name,asset_assetid,asset_url,asset_published_short,asset_data_metadata,asset_data"
Thoughts/suggestions would be appreciated from those who dabble within the squiz/JS realm?
Thanks again.