Chaining modifiers to modifiers

Hi Guys,

 

I'm wondering if anyone has been able to use modifiers to satisfy the following pseudocode:

if globals_asset_metadata_value_1 = 1 then 
  globals_asset_metadata_value_2^as_asset:asset_name
else
  null

I've tried:

%globals_asset_metadata_value_1^replace_keywords:eq:1:globals_asset_metadata_value_2:as_asset:asset_name% (etc.)

and

%globals_asset_metadata_value_1^eq:1:globals_asset_metadata_value_2^as_asset:asset_name% (etc.)

 

I've been modifying keywords for a while now and I know it has limitations. Just want to know if anyone has any secret hacks?

 

I'll resort to a paint layout applied to nested content in the mean time.

 

Chris

With replace_keywords, you need to enclose replacements with braces:

http://manuals.matrix.squizsuite.net/keyword-replacements/chapters/keyword-modifiers#Using-Keyword-Replacements-as-Argument-Values


Does that help?


Tom

With replace_keywords, you need to enclose replacements with braces:
http://manuals.matrix.squizsuite.net/keyword-replacements/chapters/keyword-modifiers#Using-Keyword-Replacements-as-Argument-Values

Does that help?

Tom

 

I tried this one yesterday but just tested with it again just to check. Does anyone know what version replace_keywords was introduced. i can't get it to work!

 

Tom, i did some more searching and you asked the same question: http://forums.squizsuite.net/index.php?showtopic=12209. Did you get that to work, no one answered your forum post!

 

Does anyone know what version replace_keywords was introduced.

 

v4.10.0 - http://www.squizlabs.com/squiz-matrix/squiz-matrix-newsletter-372

What version are you on Chris? Tom is right, you need the curly brackets in there. Did you try and do it without keyword modifiers inside the replacement value first to see if that works?

 

%globals_asset_metadata_value_1^replace_keywords:eq:1:{globals_asset_metadata_value_2}%

 

?

I'm working with 4.12.2

 

I tried both, with and without.

I just confirmed again it isn't working using the exact copy/pasted source from Bart.

More to this: It seems that this is related to this bug: http://bugs.matrix.squiz.net/view_bug.php?bug_id=6407

 

it looks like the globals keywords wasn't supported by replace_keywords until sometime after 4.16. I have tested this on 4.12 and found it failed, and it works in 4.18. 

 

BUT there is an interesting complication when it comes to keyword scope in 4.18:

WORKS: %globals_asset_name^replace_keywords:notempty:{globals_asset_assetid}%

!WORKS (in standard page or type format): %globals_asset_name^replace_keywords:notempty:{asset_assetid}%

 

It seems as though when using replace_keywords you can only refer to to a keyword within the current scope of the former keyword i.e. globals or local.

I tested %globals_asset_name^replace_keywords:notempty:{asset_assetid}% in 5.0.3.0 and it seems to work.

 

And so does %asset_name^replace_keywords:notempty:{asset_assetid}%

 

Maybe something since 4.18 was fixed to handle it.

Agreed, I just tested on 5.0 as well

I'm now working on a v5+ system. I'm able to get replace keywords, but now I'm having problems with modifying keywords that are being interpreted with replace_keywords.  

 

Is it expected functionality that 

%globals_asset_metadata_foo^replace_keywords:eq:1:{globals_asset_assetid}: %

works nicely but

%globals_asset_metadata_foo^replace_keywords:eq:1:{globals_asset_assetid^as_asset:asset_name}: %

doesn't work?
 

My actual purpose is:

%globals_asset_metadata_foo^replace_keywords:eq:1:{globals_asset_contents:111}: %

 

It looks like it gets confused with the colon, i.e. matrix is executing the keyword sequentially rather than parenthetically. is that the case?

Yea this was reported not working earlier this week as well, looks like the modifiers aren't working inside the {} bit, which they probably should. Hasn't been fixed yet however. 

Could you do something like this as a workaround?

 

%globals_asset_metadata_foo^:eq:1:111:^as_asset:asset_contents%

It might generate an error if it doesn't eq 1, but you might be able to print an asset id that doesn't have any content in that case? So something like

 

%globals_asset_metadata_foo^:eq:1:111:222^as_asset:asset_contents% where id 222 is an asset with no content. 

Thanks Bart, I'll try it out

 

Yea this was reported not working earlier this week as well, looks like the modifiers aren't working inside the {} bit, which they probably should. Hasn't been fixed yet however. 

 

Im using Matrix v4.18.5 and can't seem to get global keywords working inside the { }.

I have a search page asset displaying assets then grouping it by a metadata field (that part is working fine and is not the issue).

 

Here's the issue:

Im trying to link the group name to specific assets (outside the search page criteria) depending on the group name (metadata field)

 

%group_name^replace_keywords:replace:Business Administration:{globals_asset_short_name_linked:11528}%

 

When using the keyword above it fails (displays {globals_asset_short_name_linked on screen) when I remove the globals_ and _11528 the keyowrd itself works but is then using the wrong linked asset short name.

 

Can someone let me know what to use instead of the : symbol as that seems to be an issue as well.

Anyone other ideas on how to fix this would be great.

This might give a clue - mixing global and non-global keywords with modifiers might not work:

 

http://forums.squizsuite.net/index.php?showtopic=12207&p=52774

This works for me in 5.1.4.0, might have been a bug that was fixed in 5.0.4.4: http://manuals.matrix.squizsuite.net/patches/5.0.4.4 

 

Possibly this one: 

  • Fixed Bug #5724: replace_keywords does not work same as manual