Discussions

Expand all | Collapse all

Countdown days until a specified date

  • 1.  Countdown days until a specified date

    Top
    Contributor
    Posted 03-08-2018 19:24
    So I have two fields: the first is a projected 'delivery date' and the second is a 'how many days until delivery" (essentially, its a countdown).  On the Days-Until-Delivery field I have the following formula:

    ToDays([Projected Launch Date] - Today())

    And it works great. Problem is, after it reaches the due-date, it starts to show a negative value.  I would like it to simply 'zero' out once the due-date is achieved (I already have it set-up to show any records that are past the due-date to be highlighted in red). Any suggestions on how to code this out?

    Thanks in advance for your help.


  • 2.  RE: Countdown days until a specified date

    Posted 03-08-2018 19:26
    if you want a zero, this this will work

    Max(ToDays([Projected Launch Date] - Today()),0)

    That way it will never go below zero.

    But if you want null (blank) then it would be

    var number Countdown = ToDays([Projected Launch Date] - Today());

    IF($Countdown >0, $Countdown)


  • 3.  RE: Countdown days until a specified date

    Top
    Contributor
    Posted 03-08-2018 22:35
    Thanks - I'm really glad that I asked, since my solutions were not even close to what you have there (and also why they weren't working!).  I do like the idea of the null, so I appreciate that suggestion, as well.