Formula for date calculation

Hello guys,

Thank you for your guides and supports, I have successfully settled the problem of creating the dynamic table.

I have other problems - regarding the date calculation as below:-

i. There is 1 field in the form, i.e date of purchase of the item. From this date we have to compare with the current year - if the difference between this 2 dates >= 5 years then

we have to list down this item in the view that are due for wright off.

ii. There are 2 fields in the form i.e. start date of contract and end date of contract. If the difference between the current date and

end date of contract is = 3 months, then we have to list down this item in the view to give the user information (alert) that the contract item will expired within 3 months and due for renewing of the new contract.

I hope there will be experts out there to response and give ideas and suggestions to solve the above problems. I have very little knowledge about the formulas and lotus scripts. I’m very desperate cause time is running out and the due date of this project is coming soon.

Thank you and regards.

Subject: RE: Formula for date calculation

i. There is 1 field in the form… compare with the current year - if the difference between this 2 dates >= 5 years then list this item in the view that are due for write-off.

There are a few different ways to do this; the most straight-forward is to have a view with a selection formula such as:

SELECT Form = “whatever” & WrittenOff = “0” & PurchaseDate <= @Adjust(@Today; -5; 0; 0; 0; 0; 0);

However, this may harm performance because each document has to be re-evaluated to see whether it should be in there every time the view is used. There are alternative ways to code this, which have been discussed at length here and in the 4/5 forum – search for “@Today” and view and select and you should find useful things.

If you have very many documents, it might be better to create an agent to set a field in the documents that should appear in your view, run the agent nightly, and use that field in the view selection formula instead of testing @Today.

Another thing to consider – if someone needs this view for a task of writing off assets older than 5 years, then there’s actually no need to have the view display only assets that need to be written off. If it displays all un-written-off assets sorted by purchase date, then someone can just start at the top of the view and write-off the oldest item. Repeat until the oldest item is < 5 years old.

ii. There are 2 fields in the form i.e. start date of contract and end date of contract. If the difference between the current date and end date of contract is = 3 months, then we have to list down this item in the view to give the user information (alert) that the contract item will expired within 3 months and due for renewing of the new contract.

Don’t see how the start date matters here. Everything I said above applies here also.