Jump to content

What happened to TODAY?


 Share

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

Recommended Posts

I am just getting to know v. 7. My first note of sadness came when I learned that they evidently did away with the TODAY function. They have a Get(current date) function but this does not seem to update (IOW, it gets the current date the first time it runs but does not update thereafter).

Why would the developers get rid of the TODAY function? I use it in a number of calculations.

What is the most elegant way of restoring this functionality?

Thanks,

Mark

Version: v7.x

Platform: Mac OS X Panther

Link to comment
Share on other sites

Today is a leftover from old versions. You should convert all your Today calculations to use Get (CurrentDate) in FM7 and Status(CurrentDate) in FM6 & earlier.

Today does not function correctly in all situations, so your current calcs may be returning erroneous results.

Link to comment
Share on other sites

> it gets the current date the first time it runs but does not update thereafter

Is the calculation containing the Get(CurrentDate) set to unstored? If it is stored, you may need to force a recalculation.

Link to comment
Share on other sites

CyborgSam is right, it's gotta be unstored if you want it to update itself.. but before you do this, think really hard about what you're wanting to accomplish. If it's used in some sort of listview or calc with +100s of records, you're in for a wait while it calculates (just like the old time Today function).

With the new relationship power in FM7, you may find that you can do away with this need for a CurrentDate unstored function. I know I used to use it in a realtionship that would display a list of items that were less than X days old. Now, I can just write the relationships against the actual date in question instead of another calc field that was used to tell me how old the record was and then an automated find on that field (e.g. "<= 2" days old).

Link to comment
Share on other sites

On conversion FM 7 will create a script to update your Today fields. It does this by creating another field, named "Today," regular date field. So, wherever you had "Today" in your calculations, it will now point to the "Today" field ('cause it's named the same). Pretty clever. Both the field and the script are commented. Take a look.

The script is fairly simple. It uses Replace. Personally I would change it to a Loop script, which behaves better in networked situations. You'd also want to be on a dedicated Form View layout when you run the script. I'd recommend some text on that layout telling people what's going on (in large files it can take a while). The date field must be on that layout, but can be hidden.

I haven't done this yet on 7, but I've done it on 6. I stopped using Today a while ago. The Loop is not really faster, about the same.

Another little kink, if you want to get serious, is that either Replace or Loop is going to mess with your modification date (I imagine, haven't tested on 7). I've created a little routine to protect it, using a separate Lookup field, and turning off the lookup temporarily.

Link to comment
Share on other sites

Yes, I would concur with Bruce. Look hard at any other method to get your results. A stored Today field is an absolutely last resort. In most cases Finds can be rewritten, using Get(CurrentDate), or the new relationship capabilities using comparative operators may do what you need.

Link to comment
Share on other sites

This topic is 6502 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
 Share

×
×
  • Create New...

Important Information

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