randyB911 Posted March 11, 2008 Share Posted March 11, 2008 I am trying to create a date calculation that will project a reckoning period date based on a penalty code. I know ... like ... shoving it to the workers smiley_cool . Here is what I have so far: if(PENALTY CODE="A" OR PENALTY CODE="B" OR PENALTY CODE="C",VIOLATION DATE+365,VIOLATION DATE+720) This calc returns the date as a number like 733495. The VIOLATION DATE+720 represents a "D" penalty that carries a 2 year reckoning period. thanks in advance, randyB911 Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted March 11, 2008 Share Posted March 11, 2008 a) I assume that your desired output would look like a Date, not 733495? That's the problem? If that's NOT what you're writing about, please clarify. b) This calc field.... is the result type definitely set to "Date", at the bottom of the formula window? c) Is Violation Date definitely a Date field? d) Do you really and truly want 365 days and 720 days, respectively, or would you perhaps prefer exactly one year and exactly two years, respectively, instead? If the latter: TextToDate (Month(Violation Date) & "/" & Day(Violation Date) & "/" & (Year (Violation Date) + Case(PENALTY CODE="A" OR PENALTY CODE="B" OR PENALTY CODE="C", 1, 2) ) ) Quote Link to comment Share on other sites More sharing options...
Ender Posted March 11, 2008 Share Posted March 11, 2008 Make sure the result of the calc is a Date, not a Number. Quote Link to comment Share on other sites More sharing options...
randyB911 Posted March 11, 2008 Author Share Posted March 11, 2008 a) I assume that your desired output would look like a Date, not 733495? That's the problem? If that's NOT what you're writing about, please clarify. b) This calc field.... is the result type definitely set to "Date", at the bottom of the formula window? c) Is Violation Date definitely a Date field? d) Do you really and truly want 365 days and 720 days, respectively, or would you perhaps prefer exactly one year and exactly two years, respectively, instead? If the latter: TextToDate (Month(Violation Date) & "/" & Day(Violation Date) & "/" & (Year (Violation Date) + Case(PENALTY CODE="A" OR PENALTY CODE="B" OR PENALTY CODE="C", 1, 2) ) ) IT WORKED smiley_cool smiley_cool smiley_cool Thank you SO much !! This is exactly what I was looking for. Have a GREAT DAY !!! randyB911 Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted March 11, 2008 Share Posted March 11, 2008 Actually it would fail on you IF the Violation Date happened to be February 29, 2008. Better subtract a day FIRST if violation date happens to be a leap year. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.