Forum Discussion

Re: Jinja If else statement syntax

I couldn't find anything either, but somehow have this in my notes, which basically echoes what you have. I can't remember where I got this, but I am pretty sure I found it on Quickbase Junkies page, so give her the credit! Unless it's wrong, then it probably wasn't her :)

//Below is general if/else in Pipelines with jinja. can do this for setting specific fields

{% if  some_condition %} {{do something }}
{% elif  some_other_condition %} {{do something }}  
{% else %} {{do something }}
{% endif %}

I also have these notes about mapping null fields:

When updating a record and mapping some fields to others, if the source field is null, Pipelines will not map that field, it skips it. However, if the goal is to map exactly, even a blank field, then use the following (using field date as an example):

{% if a.date is none %}
{{ CLEAR }}
{% else %}
{{a.date}}
{% endif %}

Could also be written in the condensed format as (I use this, simple and quick):

{{ CLEAR if a.date is none else a.date }} 



------------------------------
Mike Tamoush
------------------------------
No RepliesBe the first to reply