10 Replies Latest reply on Oct 15, 2012 3:00 PM by comment

# End of life cycle Date calculation help

I am trying to figure out the calculation script for the following: Date Purchase (date) - 5 Years (value) to produce a End of Life cycle out put answer. Such as a Laptop that was purchased on July 7, 2005, with a 5 year life cycle value, outputs "End of Life Cycle" in the life cycle tab. And items that are still "Good" (less then 5 years) shows "In Service"

Thanks for any help any one can offer.

Terry

• ###### 1. Re: End of life cycle Date calculation help

EOL date = Date Purchase (date) + (5 * 365)

will give you the date 5 years later.

1 of 1 people found this helpful
• ###### 2. Re: End of life cycle Date calculation help

You could do something like this...

Let(

EOL = Date Purchase (date) + (5 * 365);

if(get(CurrentDate) > EOL; "End of Life Cycle"; "Good"))

This uses the suggestion above and puts the result you are looking for in the field.  This would be a calculation field of type text.

HTH

Bruce

1 of 1 people found this helpful
• ###### 3. Re: End of life cycle Date calculation help

on 2012-10-15 14:19 tnorling wrote

I am trying to figure out the calculation script for the following: Date Purchase (date) - 5 Years (value) to produce a End of Life cycle out put answer. Such as a Laptop that was purchased on July 7, 2005, with a 5 year life cycle value, outputs "End of Life Cycle" in the life cycle tab. And items that are still "Good" (less then 5 years) shows "In Service"

today is date calculations day! assuming you mean to expire on the same date

five years hence, you'll need to accommodate one or two leap years, so be

careful of assuming 365 days per year; this should do it, and even work on leap

days:

```Case (
Get ( CurrentDate ) < Date ( Month ( Date Purchase ); Day ( Date Purchase )
; Year ( Date Purchase ) + 5 ) ;
"In Service" ;
"End of Life Cycle" )
```

• ###### 4. Re: End of life cycle Date calculation help

Thanks guys for your help. Steve your script worked perfect! Thanks for everyones help

• ###### 5. Re: End of life cycle Date calculation help

Steve

Quick question, what if an item only had a 3 year life cycle. (Everything else has a 5 year) is there a way to factor the 3 year EOL into the script? Or say a 10 year EOL?

• ###### 6. Re: End of life cycle Date calculation help

Why don't you have a field for the EOL? Then you can make your calculation =

```Let (
end = Date ( Month ( Date Purchase ) ; Day ( Date Purchase ) ; Year ( Date Purchase ) + EOL )
;
Case (
Get ( CurrentDate ) < end ; "In Service" ; "End of Life Cycle" )
)
```

where EOL is a Number field representing the number of years of life cycle.

---

Note that this calculation must be unstored, since it needs to update as the current date progresses.

Message was edited by: Michael Horak

• ###### 7. Re: End of life cycle Date calculation help

Here are two screen shots with what I am working with and the script. Steve's answer above worked great for what I was asking in the begining. Then I got the crazy idea to change the valable of "5" to be any number

• ###### 8. Re: End of life cycle Date calculation help

Same thing: just change the number 5 in the formula to Depreciation Years.

• ###### 9. Re: End of life cycle Date calculation help

Winner Winner Chicken Dinner! It works!

Last question. When there is not a date in the "Date Purchased" the EOL defaults to "End of Life Cycle". Is there a way to leave the EOL Date blank if the Date Purchase is blank. Thanks for all your help. You guys are making me look like a rock star, getting this database to work correctly. Much Love!

• ###### 10. Re: End of life cycle Date calculation help

Just wrap the entire calculation in another Case () statement =

Case ( Date Purchased ;

what you have now

)

BTW, your EOL Date is not a date - perhaps you should rename it to EOL Status?