1 2 Previous Next 23 Replies Latest reply on Jun 22, 2016 9:46 AM by siplus

    Get(currentdate)

    lanclos

      Looking for a better option that Replace Field Contents with current date - in databases with hundreds of thousands of records, it takes forever to update. I need a better way to have the current date notated on every record every day

       

      I have been told to use an unsorted calc field and set the date - I need the current date set for every record in the database, every day - trying to find the best way to do this using a hosted database on filemaker server

        • 1. Re: Get(currentdate)
          coherentkris

          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?

          • 2. Re: Get(currentdate)
            mgeerdes

            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?

            • 3. Re: Get(currentdate)
              patricia

              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.

               

              patricia

              • 4. Re: Get(currentdate)
                patricia

                You will need to create a looping script.

                 

                Could it also be your network or equipment that is slow?

                • 5. Re: Get(currentdate)
                  karina

                  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,

                  • 6. Re: Get(currentdate)
                    coherentkris

                    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.

                    • 7. Re: Get(currentdate)
                      coherentkris

                      Karina,

                      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.

                      • 8. Re: Get(currentdate)
                        karina

                        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.

                        • 9. Re: Get(currentdate)
                          siplus

                          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.

                          • 10. Re: Get(currentdate)
                            coherentkris

                            i asked the very same thing..

                            • 11. Re: Get(currentdate)
                              siplus

                              The more we are, the louder we are

                              • 12. Re: Get(currentdate)
                                lanclos

                                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?

                                • 13. Re: Get(currentdate)
                                  karina

                                  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

                                  • 14. Re: Get(currentdate)
                                    coherentkris

                                    go to first record

                                    loop

                                    set field whatever

                                    go to next record (exit loop at last)

                                    end loop

                                     

                                    seems to be faster than replace field contents.

                                    1 2 Previous Next