Forum Discussion

hjengelson's avatar
hjengelson
Qrew Member
28 days ago

Jinja If statement equals field value

I'm trying to write an If statement in Pipelines for an email that if the Separation reason is retirement, do a line break and include the field value for if they are staying with the company as an instructor. If the reason is anything else, do a line break and move on to the next line.

{% if a.reason = "Other - Retirement" %} <br>Staying as Instructor:<b> {{a.instructor}}</b><br>{% else %}<br>{% endif %}

This is the same-ish format I was using for another Pipeline and it works just fine so I'm so confused as to why this one isn't working. The error says Incorrect Template. expected token 'end of statement block'. got '='

I want it to look like this if true:

Reason: Other - Retirement
Staying as Instructor: Yes/No
Next line: Value

If False it should look like this:

Reason: Other - Resignation
Next line: Value

Please help!! Thank you!

  • I am slowly, ever so slowly, learning some Jinja.  In the Advanced Expressions I have discovered that the double equal sign is necessary.

    {{a.numeric_field ==1or a.numeric_field ==3}}

    Perhaps that is what you need to ensure the text values are the same.  My understanding is that "=" sets something where as "==" checks if it is equal.

     

  • I am slowly, ever so slowly, learning some Jinja.  In the Advanced Expressions I have discovered that the double equal sign is necessary.

    {{a.numeric_field ==1or a.numeric_field ==3}}

    Perhaps that is what you need to ensure the text values are the same.  My understanding is that "=" sets something where as "==" checks if it is equal.

     

    • hjengelson's avatar
      hjengelson
      Qrew Member

      I appreciate the reply Don! I tried that because I had seen that somewhere else and it's still giving me the same error. I have tried the value encased with " and with ' and without anything and I still get the same error.

  • I had a different problem. Pipelines wasn't loading so nothing was saving when I made the updates. == worked! Thank you Don for the quick reply!