Skip to main content
Solved

Jinja Expression Comparing Now to Now+Hours

  • January 31, 2024
  • 0 replies
  • 525 views

SSNJeffP
Forum|alt.badge.img+11

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
------------------------------

Best answer by DonLarson

Jeff,

 I got something close to what you are looking for.  This Pipeline compares two fields and then will update the record with the results of that evaluation.   

https://github.com/mcfindustries/Magic/blob/master/Community/If%20Statement%20%20Time.Now%20Plus%20Hours.yml



------------------------------
Don Larson
------------------------------

Forum|alt.badge.img+9
  • Registered
  • January 31, 2024

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
------------------------------