Forum Discussion

JeffPeterson1's avatar
Qrew Captain
4 months ago

Jinja Expression Comparing Now to Now+Hours

I'm trying to compare the date created (fid1) to the current time, based on a value in KM Tier (fid1481).   The pipeline runs without errors but I'm not sure if this syntax is correct.   Does this look correct?   This should resolve to TRUE if, for example the KM Tier is 1 and it's more than 24 hours past the date created.

{% if
    (fid1481 == 1 and now > fid1 + hours(24)) or
    (fid1481 == 2 and now > fid1 + hours(72)) or
    (fid1481 == 3 and now > fid1 + hours(96)) or
    (fid1481 == 4 and now > fid1 + hours(240))
{% endif %}

Jeff Peterson

3 Replies

  • Just an observation - is there any reason you have to do this in Pipelines? Can you just make a formula checkbox in the QB table and compare with an easier to use formula versus Jinja and then have your Pipeline check if the box is checked?

    Chayce Duncan