Avoiding date/time formulas in views

Having date/time formulas like @Now causes servers to overload by refreshing views all the time. Here is what you have to do to avoid this.

Put this code in the postopen of your database.

@SetEnvironment("MyDate";@Text(@Now))

When a user opens the database, it will put the today's date in his local notes.ini file.

If you have a column or the selection formula in the view that needs to control the today's date, you just have to recuperate the value in the notes.ini by using this code:

w_date:=@TextToTime(@Environment("MyDate")); etc.

This was first published in July 2001

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.