If Statement on Custom Form - Compare Date Fields to Show not Meeting Deadlines | Community
Skip to main content
February 16, 2024
Question

If Statement on Custom Form - Compare Date Fields to Show not Meeting Deadlines

  • February 16, 2024
  • 2 replies
  • 809 views

Hi,

 

I am attempting to create a custom form calculated field to show if we met our agreed upon due date.

 

We have a field on a custom form labeled 'SLA Date' that is auto generated with a date 5 days after submission - this field uses the current parameters of:

 

ADDWEEKDAYS({entryDate},5
 
I am then trying to compare that field to Actual Completion Date.
 
I am using the following parameters and continue to get 'N/A' - Does anyone have any idea why this is not pulling correctly? 
 
IF({DE:SLA Date}<{actualCompletionDate},"SLA MET","SLA Not Met")
 
I am trying to say - If 'SLA DATE' is less than 'Actual Completion Date' then put 'SLA MET'. If it is not put 'SLA Not Met'
 
If the reasoning is due to the 'SLA DATE' field being an already calculated field causing issues. I can also use another Custom Form Field - 'Expected In-Market Date' - which is just a standard Date Custom Form field. 
 
Any advise or guidance would be helpful. 
 
Thanks everyone! 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

skyehansen
Community Advisor
February 16, 2024

You might discover that the less than/greater than functions only work with numbers (not dates), so you might want to retool to say something like "if the difference between these two dates is less than (or greater than) some number".

 

e.g. IF(WEEKDAYDIFF({DE:SLA Date},{actualCompletionDate})>0,"SLA MET","SLA Not Met")

 

So basically think up some equation that results in a number being greater or less than some other number.

 

And, I would also double check to make sure your initial calculated field is formatted as a date field.

J_Mas
Level 5
February 16, 2024

I recreated your DE:SLA Date in my sandbox environment, gave it a try, and it worked for me. My main difference is that on the "SLA Met" calculation, I added a condition to look at the project status and only check the DE:SLA Date if the Project Status was Complete.

Here's the code I used.

IF(CONTAINS("CPL",{status}),IF({DE:SLA Date}>{actualCompletionDate},"SLA Met","SLA Not Met"),"")

And here's some screenshots: