Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How do I make FMP5 'aware' of current date?


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

Recommended Posts

Posted

Is it possible to have a single DB 'aware' of the current date without running a script or creating a record? I know how to do it by running scripts or creating a record but that's not what I need.

This is ultimately for a web based solution to generate a "Word of the Day" that is the same for every visitor for that day and then changes to the next one on the next day. The "Words of the Day" will be pre-loaded by a user via the web.

I want it to be totally automatic inside FMP but can't figure out how to.

Thanks in advance for any help.

Cael.

Added 2/19 ------

I played around with it and used a calculation status(currentdate) as an unstored calculation that gives me the date with no "/" so I can use it in another field which concatenates into an absolute URL.

LeftWords(DateToText(Status(CurrentDate)), 1) &

MiddleWords(DateToText(Status(CurrentDate)), 2, 1) &

RightWords(DateToText(Status(CurrentDate)), 1)

Today's date ends up like this: 2192001

I concatenated several user defined fields into one absolute URL pointed to an html file and am would like to use that field inside an [FMP-Include] tag. But I'm not sure if the date will reliably update automatically when called from the web inside the url.

[This message has been edited by CaelC (edited February 19, 2001).]

Posted

Instead of using a calculation status(currentdate) try using a calculation TODAY - it might give the date in the same format, but it updates at midnight.

Posted

Sorry, StevenB, but the TODAY function does not automatically update. The file must be closed and re-opened to recalculate TODAY, or a script must be run to force the recalcuation. FMI does not recommend using TODAY for solutions that are server based or hosted in Unlimited.

The preferred way is Status(CurrentDate) - this does automatically update.

Posted

Thanks everyone for your input!

I am using Status(CurrentDate) for the reason previously mentioned.

But does anyone know for sure if it will update automatically when called from a format file in an instance such as this:

e.g. ---

<IMG SRC="[FMP-Field: Absolute_URL]">

Where I want the image to change daily and the field Date is a calculation that returns a text date and a path to the image for the day using this to determine the day:

LeftWords(DateToText(Status(CurrentDate)), 1) &

MiddleWords(DateToText(Status(CurrentDate)), 2, 1) &

RightWords(DateToText(Status(CurrentDate)), 1)

This gives me a date such as 2222001 which I then append a .gif to (with a field called gFileExtension) and put the rest of the absolute URL in using a field called gServer like so:

gServer & "/" & RightWords(DateToText(Status(CurrentDate)), 1) & "/"

& MonthName(Status(CurrentDate)) & "/"

& Date_Today & gFileExtension

This returns a result (an absolute path name to the image) in the format file essentially like this that should change on a day to day basis:

<IMG SRC="http://www.servername.com/February/2222001.gif">

So, ultimately does this reliably and accurately return the correct date from that original Status(CurrentDate) calculation?

Maybe at this point I should move the question over to the CDML forum?

Thanks for all the help so far and for any more that can be offered!

Cael.

Posted

quote:

Originally posted by CaelC:

Thanks everyone for your input!

I am using Status(CurrentDate) for the reason previously mentioned.

But does anyone know for sure if it will update automatically when called from a format file in an instance such as this:

If you make the calc UNSTORED, it should be recalculated everytime it is called.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Consultant

Database Resources

mailto:[email protected]

http://www.database-resources.com

=-=-=-=-=-=-=-=-=-=-=-=-=

This topic is 8675 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.