Compare Date Fields and write sum in a third field

Issue #541 resolved
DavidF created an issue

Hello Fidel,

Patrick Schuh says hi ;-) He is my colleague. We both love working with your toolbox in our Workflows. Great Add-on! Thank you very much!

I was wondering if the following is possible in a single transition (or possible at all):

I have two date fields: Startdate and Enddate. Is ist possible to compare the values and calculate the diffrence between the two dates so that it would result as a number of days? The result in days should be written to a third custom field.

Thank you for your help!

Cheers David

Comments (3)

  1. Fidel Castro Armario repo owner

    Hi David,

    I assume that the third custom field, i.e., the one you want to set, is a number field.

    You should use "Mathematical and date-time expression calculator" with any of the following formulas:

    1) The result may contain decimals:

    ({eeeee} - {sssss}) / {DAY}
    

    2) The result will only show the integer part of the calculation:

    floor(({eeeee} - {sssss}) / {DAY})
    

    3) The result will be rounded to the nearest integer:

    round(({eeeee} - {sssss}) / {DAY})
    

    where eeeee is field code for Enddate, and sssss is field code for Startdate.

    Consider also the usage of a "Calculated Number Field" using any of the following formulas:

    1) The result may contain decimals:

    {eeeee} != null AND {sssss} != null ? ({eeeee} - {sssss}) / {DAY} : null
    

    2) The result will only show the integer part of the calculation:

    {eeeee} != null AND {sssss} != null ? floor(({eeeee} - {sssss}) / {DAY}) : null
    

    3) The result will be rounded to the nearest integer:

    {eeeee} != null AND {sssss} != null ? round(({eeeee} - {sssss}) / {DAY}) : null
    

    You should select duration as display format. This way you will get a pretty displaying of the duration. For example: 1 week, 2 days

  2. Log in to comment