Skip to main content
Solved

Advanced Datediff formula


Justin Bills
Forum|alt.badge.img+2

Good morning -

 

I’m trying to build a datediff formula in a calculated field that would find the difference between a start and end date, but if the end date was blank it would use today.  Is that possible without leveraging the rules engine?

Best answer by Justin Bills

Hi @jessica_owens  -  I did!!

I made a custom calculated field:

CASE
    WHEN (field end date) IS NULL THEN gsdateDiff( field start date , gstoday( ) , 'DAY' )
    ELSE gsdateDiff( start date , end date , 'DAY' )
END

 

The bold/italic would be replaced by whatever your fields are in your instance! :)

View original
Did you find this topic helpful?

3 replies

jessica_owens
Forum|alt.badge.img+3

Did you ever find a way to do this without rules engine?


Justin Bills
Forum|alt.badge.img+2
  • Author
  • Helper ⭐️
  • 20 replies
  • Answer
  • August 31, 2022

Hi @jessica_owens  -  I did!!

I made a custom calculated field:

CASE
    WHEN (field end date) IS NULL THEN gsdateDiff( field start date , gstoday( ) , 'DAY' )
    ELSE gsdateDiff( start date , end date , 'DAY' )
END

 

The bold/italic would be replaced by whatever your fields are in your instance! :)


benwanlessmenlo
Forum|alt.badge.img+4
  • Contributor ⭐️⭐️⭐️⭐️⭐️
  • 115 replies
  • June 3, 2024

This is awesome!

The only thing I’ll add to anyone who finds this answer later is that I had to use the “Field Name” (i.e. Custom_Date_Field__gc ) in order for it to work.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings