Page Type Transform not running after change

Sam Loveland asked on May 8, 2019 23:56

I have a page type which is part of the master page for the header. It has two transforms which I have updated, but since making the changes to the transform they do not appear to run. I have tried closing my browser and re-logging, and I have re-signed the macros a few times now, but the HTML output doesn't contain the transforms.

Changes made:

Page Type: * ECY – Global Alert > Transformations

Active transformation:

Outputs a css class to the header element

FROM:

            `{%Enabled == true ? " alert " : ""%}`

TO:

            `{%Enabled == true ? " site-header header-alert-active " : " site-header "%}`

Alert transformation:

Outputs the alert content

FROM:

<div class="alert-text-container" >
    <a class="alert-hide-btn" tabindex="0">Hide Alert</a>
    <div class="alert-text">   
        <!--{% IfEmpty(AlertIcon, "<img alt=\"" + Eval(AlertIconAltText) + "\" src=\"" + Eval(AlertIcon) + "\" />", ) %}        -->
        {% IfEmpty(AlertIcon, "", "<img alt=\"" + Eval(AlertIconAltText) + "\" src=\"" + Eval(AlertIcon) + "\" />") %} 
        <h4>{%Alert%}</h4>
    </div>
</div>

TO:

<div class="header-alert" role="alert">
    <a class="alert-hide-btn" tabindex="0">Hide Alert</a>
    <div class="alert-text">   
        <!--{% IfEmpty(AlertIcon, "<img alt=\"" + Eval(AlertIconAltText) + "\" src=\"" + Eval(AlertIcon) + "\" />", ) %}        -->
        {% IfEmpty(AlertIcon, "", "<img alt=\"" + Eval(AlertIconAltText) + "\" src=\"" + Eval(AlertIcon) + "\" />") %} 
        <p>{%Alert%}</p>
    </div>
</div>

When I look at the resulting HTML output, it is not transforming correctly. Not sure what I’m missing. I’ve been working on figuring this out for over an hour now.

Correct Answer

Juraj Ondrus answered on May 9, 2019 08:22

It looks like you are mixing ASCX and text transformations. There is no macro method for IfEmtpy. Also when using text transformation and macros, there is no Eval method. You just use the column/field name - just like you already have {%Alert%}.
The text transformation macro could look like this:
{% AlertIcon.ToString().IsNullOrEmpty() ? "" : "<img alt=\"" + AlertIconAltText + "\" src=\"" + AlertIcon + "\" />" |(identity)GlobalAdministrator%}

0 votesVote for this answer Unmark Correct answer

Recent Answers


Sam Loveland answered on May 9, 2019 00:42 (last edited on May 9, 2019 01:28)

EDIT: Nevermind, still not working. I'm debugging output and seeing that the macros for this transform are returning null, but I'm not sure why and resigning macros hasn't helped.

0 votesVote for this answer Mark as a Correct answer

Sam Loveland answered on May 9, 2019 15:09

Thank you Juraj, I found that the output began working somewhere between your transforms advice, signing macros, and clearing cache/restarting the application.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.