How do I formulate IF Date Created is null, show difference from today and due date; otherwise show difference from Date Created and Due Date?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
I was able to get the WeekDay Sub function to work but then realized that the calculation doesn't occur when entering a new ticket because the Date Created field doesn't populate until it is saved.

Here's what I'm trying but I have a syntax error.

If([Date Created]=null, WeekdaySub([File Due Date], ToDate(Today()), WeekdaySub([File Due Date], ToDate([Date Created]))

I realize my delimiters (,) are odd here but have no idea of how to structure this.


Thanks in advance for the help!


Photo of Jason

Jason

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,780 Points 50k badge 2x thumb
Try this

If(IsNull([Date Created]), 


WeekdaySub([File Due Date], Today()), 

  WeekdaySub([File Due Date], ToDate([Date Created]))
Photo of Jason

Jason

  • 0 Points
Thanks for the reply. Unfortunately I'm getting a syntax error with this one as well.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,780 Points 50k badge 2x thumb
If the field type is formula numeric you would need this formula

ToDays(
If(IsNull([Date Created]),
WeekdaySub([File Due Date], Today()),
  WeekdaySub([File Due Date], ToDate([Date Created])))

If that is not the problem, then please say what the syntax error is or paste it into this thread.
Photo of Jason

Jason

  • 0 Points
Thanks again - it is a formula numeric field. I tried the above but the problem persists. I also added a screenshot to the original post.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,780 Points 50k badge 2x thumb
ToDays(
If(IsNull([Date Created]),
WeekdaySub([File Due Date], Today()),
  WeekdaySub([File Due Date], ToDate([Date Created]))))

I think it needs one more closing )
Photo of Jason

Jason

  • 0 Points
Great - it works! Thanks so much for your help.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,780 Points 50k badge 2x thumb
Great.  Thx for letting me know.