cbsteven Posted November 1, 2002 Posted November 1, 2002 My database of orders placed in our store has a script which is supposed to only display orders which are open and were placed at least two days ago. To accomplish this I search by a record's OrderAge field. The field definition of this was: DayofYear(Today) - DayofYear(Creation Date) However like many people I found the long Today Calculation at startup very annoying. I did some search on this forum and it looks as though everyone recommends status(CurrentDate) as a superior replacement for Today. I changed the OrderAge function to use Status(CurrentDate). At first glance it seemed to be behaving normally, but the next day I checked and the records all had the same age that they had the previous day. I went in to the field def and turned off indexing. This made the the age update, but when I performed the 2-day Search option over a network it was VERY slow (probably as slow as the normal today calculation) Any better ideas on how to implement this without a long delay at startup or at execution?
Vaughan Posted November 1, 2002 Posted November 1, 2002 No matter what, the unstored calculation has to be performed some time or other. One solution may be to change how you perform the search: instead of doing the calculation in each record, do it int he find request. By that I mean this: You want to search for records that are 2 days old. One way is to create a calc field that works out the age in each record -- this is slow because the calc is done once for each record. The other way is to perform the find for the date that is 2 days ago: in this case the calc is peformed once -- in the find request -- not in each record. Much faster. The other reason for not using Today function is that it does not recalculate itself if the file is hosted on a server (at least not without a whole lot of mucking about). This I consider more important than the calculating at startup.
Recommended Posts
This topic is 8129 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 accountSign in
Already have an account? Sign in here.
Sign In Now