Jump to content
Server Maintenance This Week. ×

Todays Date Minus Creation Date Equals......


This topic is 8269 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I need to make a calculation that will calculate in a field every time the database is opened. The calculation will calculate Todays Date - Creation Date and generate a number of days elapsed result. I know doing a calculation will make the database open slowly because it has to calculate every record upon opening, but how else can you age the records based upon the above parameters. I don't want to have to press a script button every day. Thanks for your help!

Link to comment
Share on other sites

You can use a startup script to set a global data field (gCurrentDate) to Status(CurrentDate) and define a calculation:

Age (calculation, number) = gCurrentDate - Creation Date

Since the global is not stored, all the records will not have to be updated. The disadvantages of this approach are:

1) The result (Age) is not indexed and finds on the Age field will be slow

2) If the file is opened by a relationship, the startup script won't run and the Age value may be incorrect.

-bd

Link to comment
Share on other sites

Hello,

The database does not have to calculate every record upon opening if you use a calculated field like status(currentdate)- field(date created).

Status(current date) was introduced to replace the today function, which does calculate every record when opened.

Any calculated field that has "today" in it, should be replaced with status(currentdate).

=)

Link to comment
Share on other sites

This topic is 8269 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.