Forum Discussion

AmyGosz1's avatar
AmyGosz1
Qrew Trainee
2 years ago

Pipeline Jinja Code for Checkbox

I have a 'On New Event' pipeline to create a record in a Review Log table triggered on a change to a checkbox field - either checked or unchecked. If the checkbox is checked, the Approved field in the Review Log table should read 'yes'. If unchecked (was checked), then it should read 'no. However, it is reading 'no' for both checked and unchecked changes. I found the Jinja code somewhere but am unable to find it again so can't compare if I'm missing something. Here is my code for populating the Approved field with the pipeline during the Create Record step:

{% if a.review_food_security_approved == TRUE %}
yes
{% else %}
no
{% endif %}

So if the checkbox is checked, it is still recording a 'no' and I don't know why. What am I missing in my code?

------------------------------
Amy Gosz
------------------------------

4 Replies

  • DwightMunson1's avatar
    DwightMunson1
    Qrew Assistant Captain
    {% if a.review_food_security_approved is true %}
    yes
    {% else %}
    no
    {% endif %}

    ------------------------------
    Dwight Munson
    ------------------------------
    • AmyGosz1's avatar
      AmyGosz1
      Qrew Trainee
      Thank you Dwight. Works perfect now. I didn't even consider changing the == characters.

      ------------------------------
      Amy Gosz
      ------------------------------
      • DwightMunson1's avatar
        DwightMunson1
        Qrew Assistant Captain
        Honestly you probably could have used == or is. 
        I think it was barfing on the capital true. 

        Generally the jinja comparison operators are:
        == Compares two objects for equality
        != Compares two objects for inequality
        > true if the left-hand side is greater than the right-hand side
        >= true if the left-hand side is greater or equal to the right-hand side
        < true if the left-hand side is lower than the right-hand side
        <= true if the left-hand side is lower or equal to the right-hand side

        Also: 
        is
        is not
        matches
        starts with
        ends with 


        ------------------------------
        Dwight Munson
        ------------------------------