Discussions

 View Only
  • 1.  Pipeline error when date field is empty and using {{datefield|date_dmy}} to format date

    Posted 02-04-2022 11:19
    I have a pipeline that takes several date fields and writes them out to text fields in another table, with {{datefield|date_dmy}} used to format the date. It works when all the date fields contain a date, but fails when any of the fields are empty, producing an error 'Validation error: Incorrect template'. 

    Has anyone else had the same issue and/or know how to workaround this without adding in conditions to check for fields being blank (as this isn't a feasible solution) or creating formula fields in the table to format the dates as strings? 

    Thanks.

    ------------------------------
    Jeremy Anson
    ------------------------------


  • 2.  RE: Pipeline error when date field is empty and using {{datefield|date_dmy}} to format date

    Posted 02-07-2022 13:27
    Something like this should do the trick

    {{'' if a.datefield is none eles a.datefield|date_dmy}}
     
    If you're interested in learning more about Jinja check out this Intro to Jinja for Pipelines course.


    ------------------------------
    Quick Base Junkie
    ------------------------------



  • 3.  RE: Pipeline error when date field is empty and using {{datefield|date_dmy}} to format date

    Posted 02-08-2022 01:13
    Thanks for the advice - much appreciated!

    I managed to get there with {% if not a.datefield is none %}{{ a.datefield|date_dmy}}{% endif %}

    ------------------------------
    Jeremy Anson
    ------------------------------