If condition

Alex Koshel asked on February 1, 2021 21:20

Hi. I have field Column1Header type text. In text/xml transformation i want create condition IF.

{% if({%Column1Header%} != null)
   {   
    <div class="column-4">
        <div class="product-feature__inner" style="padding-right: 1rem;">
            <h4 class="product-feature__title">{%Column1Header%}</h4>            
            <p class="product-feature__description">{%Column1Body%} </p>
        </div>
    </div>
    }  %}
but it doesn't work.          

Correct Answer

Brian McKeiver answered on February 1, 2021 22:36

Try using !string.IsNullOrEmpty(Column1Header) in the condition instead of != null comparison.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Brian McKeiver answered on February 1, 2021 21:55

{% if (Column1Header != null) { %}
The the html text goes here with variables like: {% CurrentDateTime %}.
{% } %}
0 votesVote for this answer Mark as a Correct answer

Alex Koshel answered on February 1, 2021 22:08 (last edited on February 1, 2021 22:08)

{% if (Column1Header != null) { %}

    <div class="column-4">          
        <div class="product-feature__inner" style="padding-right: 1rem;">
          <h4 class="product-feature__title"> {% Colum1Header %}</h4>            
          <p class="product-feature__description">{% Column1Body %}</p>
        </div>
     </div>
{% } %}

dont work(

0 votesVote for this answer Mark as a Correct answer

Alex Koshel answered on February 1, 2021 22:12

if Column1Header == null i see Column1Body value

0 votesVote for this answer Mark as a Correct answer

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