Set up a server scheduled script that inserts the date into the fields and records that you want.
Start it at 00:01 AM.
The question that you should be asking yourself is why do you need such a field with the same data in every record?
I'm not sure why you would need to put the current date in every record every day. Are you just trying to display the current date on your layouts? There are other ways to do that than to update every record every day.
Can you describe what you are trying to accomplish with updating the date each day in every record?
There are many ways to get a current date but what is the fastest? I don't know if this is but suggest you use a script trigger.
You did not specify if all records are updated daily or only when going to a particular record. In that case use modify date.
Since you said it is slow I am assuming it may be all records then use script trigger when the file is open to set the date field with the current date.
You will need to create a looping script.
Could it also be your network or equipment that is slow?
If you use a global storage for the date field you use, you can set the date field in a script for example in a startup script or in a you use to go to that menu
This way you only have to set it once a day in one record,
Setting the date field in a file with hundreds of thousands of records every time the file is opened, or in response to ANY script trigger for that matter, is not an efficient use of triggers.
Given the constraints in the original post as i understand them Server Scheduled scripting is the only choice that will even remotely produce a satisfying user experience.
The OP mentions that the file is hosted so they would have to make sure that the field is set for ever user as they log on.
Global could suffice but still may not be practical.
My 2 cents worth.
That's no problem, that's the reason I mentioned to set the global date field in a startup script or a go to menu script.
If the data in that field isn't used a calculation field a global field is sufficient.
Otherwise is the script you mentioned the best solution.
If you tell us what you are doing with that currentDate in 100k + records, we might find a way to do the same thing without needing what you think you need. Not 100% guaranteed, but we might.
i asked the very same thing..
The more we are, the louder we are
wow - thanks guys - I hear you
I decided to create a demo of one of the reasons why I want it - lets say you have an Invoices database and it has due dates - you have to know what today is to do a proper aging - today-duedate is your days past due - if there are hundreds of thousands or millions of invoices - you want to do a find for all past due - you may also want to preserve when they pay - (date paid - due date) = how long it took for them to pay historically - then you could search for your best paying clients - I am currently using a server side script which does the replace with the current date right after midnight - just wanted a faster way and maybe a more clever way since it is taxing on the server at night
Thanks again community
How do I upload the demo?
Invoices.fmp12.zip 1.4 MB
And if you only fill the current date field in the records of the unpaid invoices?
That will be a lot less records I guess
go to first record
set field whatever
go to next record (exit loop at last)
seems to be faster than replace field contents.