Keyword Conditions appear not to be working


(Eliseo Dannunzio) #1

Hi everyone,

 

I seem to be having some issues with Matrix 5.3... it seems my conditions aren't working, and I'm wondering if it's a simple case of not formatting this correctly...

 

I have a metadata field, asset_metadata_MAINTENANCE.BannerType which can have one of three possible values: uk-alert, uk-alert-warning, or uk-alert-danger...

 

I've been using what knowledge I've gained from https://matrix-manuals.squiz.net/keyword-replacements/chapters/conditional-keywords to develop the following conditions, to display specific code... I'm intentionally separating the three possibilities in case the final copy for the content needs to be changed...

 

However, I'm getting all three results rendering out as though the condition is being met in all three cases, which is impossible... I'm not sure what could be causing the conditions to render out as in the attached image... I'd love to know what I can do to resolve this... Could anyone please look at this and tell me how my code could be improved so that it only displays the one condition based on the value of the metadata field?

 

Regards,

 

Eliseo

    %begin_asset_metadata_MAINTENANCE.BannerType^eq:uk-alert:1:%
        on %instance_start_datetime^date_format:l j F Y%. <b>Find out how this scheduled outage will impact your site</b><br />
    %end_asset%
    %begin_asset_metadata_MAINTENANCE.BannerType^eq:uk-alert-warning:1:%
        on %instance_start_datetime^date_format:l j F Y%. <b>Find out how this scheduled outage will impact your site</b><br />
    %end_asset%
    %begin_asset_metadata_MAINTENANCE.BannerType^eq:uk-alert-danger:1:%
        between %instance_start_datetime^date_format:g%:%instance_start_datetime^date_format:i%%instance_start_datetime^date_format:a% and %instance_end_datetime^date_format:g%:%instance_end_datetime^date_format:i%%instance_end_datetime^date_format:a%. <b>Find out how this scheduled outage affects you</b><br />
    %end_asset%

[attachment=818:theImage.png] theImage.png (37.7 KB)


(Anthony Ponomarenko) #2

Howdy, they all look good, i plugged them into my 5.3.4.0 instance and they work correctly.

 

What version of Matrix are you experiencing this in?   

try adding a 0 to the end of the keywords as the else for the eq check, maybe it doesnt like the empty value.

 

What is the value of the metadata field for the asset you are seeing this in?


(Eliseo Dannunzio) #3

Hi Anthony,

 

To answer your questions...

 

1) v5.3.2.1

2) Tried adding a 0 in the "else" component, and unfortunately all three still render out in code... I've checked with _nocache and _recache variants of the test URL... Even used various comments within the code o verify no caching has occurred...

3) The value for asset_metadata_MAINTENANCE.BannerType in this case is "uk-alert-danger", so the third condition should have been the only thing that showed, right?

 

I'm still getting conditions failing... Is there a possible area within the configuration that would "turn off" conditions, and if so, could they be turned back on? I always assumed that conditions were turned on by default and stayed that way...  


(Anthony Ponomarenko) #4

Can you do a test,

 

Can you add an else to one or all of the cases. 

 

%begin_asset_metadata_MAINTENANCE.BannerType^eq:uk-alert:1:%
        on %instance_start_datetime^date_format:l j F Y%. <b>Find out how this scheduled outage will impact your site</b><br />
%else_asset_metadata_MAINTENANCE.BannerType^eq:uk-alert:1:%
    test test test
%end_asset%
 
And let me know the results.
 
Also what asset type do you have these conditions in?