1 2 Previous Next 15 Replies Latest reply on Jan 27, 2013 10:37 AM by christinesephton

    Date calculation

    cdcreek

      I am trying to create a calculation field named upcoming_date. I want it to be equal to todays date (which it should get from the computer date) +15 days from now. I have tried many formulas using // + 15 to no avail.

      Can anyone help me? Thanks!

        • 1. Re: Date calculation
          comment

          Try =

           

          Get ( CurentDate ) + 15

           

          Note that if the calculation is unstored, it will update every time the screen is refreshed, thus pushing the upcoming date further into the future. Not sure if that's what you want.

          • 2. Re: Date calculation
            ErikWegweiser

            I believe you're looking for this formula:

             

                 getasdate( Get(currenthosttimestamp) ) + 15

             

            The formula,

             

                 Get(CurrentDate) + 15

             

            will also work, but I'm in the habit of assuming the database is or may be hosted and I always want to use the host/server's "official" time, rather than that of the client's workstation, which is what the Get function in the latter formula yields.

             

            Since this is a calculated field, be sure it is set to "unstored," so the date is constantly refreshed (unless you want the original record creation date to apply always).

            • 3. Re: Date calculation
              cdcreek

              Michael and Eric:

              Thank you both for your suggestions.  I have tried them and they both work in terms of calculating the date (15 days from today).  However when I try to use that formula in a find request, it tells me that I have an invalid format.  I have tried ever conceivable adjustment in the field settings but I cannot get it to work.  All that I am trying to do is find records in a date field matching the criteris,   > // AND < Get ( CurrentDate ) + 15, as a multifind script step.  The >// criteria works fine, the GET (command) gets the error message.  Any additional help would be most appreciated.

              Thanks again.

               

              Regards,

               

               

               

               

              Christian M. Deutsch

              Acuity Systems, Inc.

              Strategic Advisor

              Cell 917-355-7200

               

               

              Please note that this e-mail and any files transmitted with it may be privileged, confidential and protected from disclosure under applicable law. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying or other use of this communication or any of its attachments is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message, and deleting this message, any attachments, and all copies and backups from your computer.The information included is from sources deemed reliable. No representation is made as to the accuracy thereof and is submitted subject to errors and omissions.

              • 4. Re: Date calculation
                comment

                cdcreek wrote:

                 

                when I try to use that formula in a find request, it tells me that I have an invalid format.  I have tried ever conceivable adjustment in the field settings but I cannot get it to work.  All that I am trying to do is find records in a date field matching the criteris,   > // AND < Get ( CurrentDate ) + 15

                 

                Try it this way:

                 

                Enter Find Mode [ ]

                Set Field [ YourDatefield ;  Get ( CurrentDate ) & ".." & Get ( CurrentDate ) + 15 ]

                Perform Find [ ]

                • 5. Re: Date calculation
                  cdcreek

                  Michael:

                  Thanks again.  I tried that and it works for the first part of the formula (the current date) but ignores the plus 15 constraint.  The good news is I am not getting any error messages now and the script runs.  It just brings back records with the date beyond 15 days from today which I do not want.

                   

                   

                  Regards,

                   

                   

                  Christian M. Deutsch

                  Acuity Systems, Inc.

                  Strategic Advisor

                  Cell 917-355-7200

                   

                   

                  Please note that this e-mail and any files transmitted with it may be privileged, confidential and protected from disclosure under applicable law. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying or other use of this communication or any of its attachments is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message, and deleting this message, any attachments, and all copies and backups from your computer.The information included is from sources deemed reliable. No representation is made as to the accuracy thereof and is submitted subject to errors and omissions.

                  • 6. Re: Date calculation
                    comment

                    I don't know. Does this (attached) work for you?

                    • 7. Re: Date calculation
                      cdcreek

                      Noting attached.

                       

                      Sent from my iPad

                      • 8. Re: Date calculation
                        comment

                        You need to log in to see the attachments, I think.

                        • 9. Re: Date calculation
                          beverly

                          CD, Michael is telling you that the online forum only has the attached files/images. Attachments are not a function of emailed posts (send or receive). You'll need to login to the forum to see attachments.

                           

                          Beverly

                          • 10. Re: Date calculation
                            cdcreek

                            Michael:

                            Thanks again, very helpful.  Your script works well on its own.  My problem is that I am using it inside a script which uses a static find first.  I am going back to my reference manual to see if there is a best practice recommendation when combining static finds with a dynamic one.  This forum is great, thanks to all involved.

                            Regards,

                             

                             

                            Christian M. Deutsch

                            Acuity Systems, Inc.

                            Strategic Advisor

                            Cell 917-355-7200

                             

                             

                            Please note that this e-mail and any files transmitted with it may be privileged, confidential and protected from disclosure under applicable law. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying or other use of this communication or any of its attachments is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message, and deleting this message, any attachments, and all copies and backups from your computer.The information included is from sources deemed reliable. No representation is made as to the accuracy thereof and is submitted subject to errors and omissions.

                            • 11. Re: Date calculation
                              comment

                              cdcreek wrote:


                              My problem is that I am using it inside a script which uses a static find first.

                               

                              Not sure what exactly you mean. Perhaps all you need to do is:

                               

                              Enter Find Mode [ ]

                              Set Field [ YourDatefield ;  Get ( CurrentDate ) & ".." & Get ( CurrentDate ) + 15 ]

                              Set Field [ Anotherfield ;  "Some data" ]

                              Perform Find [ ]

                              1 of 1 people found this helpful
                              • 12. Re: Date calculation
                                cdcreek

                                Michael:

                                I didn't know that was possible.  Will try it out tonight!

                                Thanks again!

                                 

                                 

                                 

                                 

                                 

                                Christian M. Deutsch

                                Acuity Systems, Inc.

                                Strategic Advisor

                                Cell 917-355-7200

                                 

                                 

                                Please note that this e-mail and any files transmitted with it may be privileged, confidential and protected from disclosure under applicable law. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying or other use of this communication or any of its attachments is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message, and deleting this message, any attachments, and all copies and backups from your computer.The information included is from sources deemed reliable. No representation is made as to the accuracy thereof and is submitted subject to errors and omissions.

                                1 of 1 people found this helpful
                                • 13. Re: Date calculation
                                  christinesephton

                                  I think you want to set a variable first, and include the variable in the find when performing a script find.

                                   

                                  Example:

                                   

                                  Set Variable [$date] Calculation:  Get(CurrentDate)+15

                                  Perform Find [date field=$date]

                                   

                                  That will allow you to perform the find in a script without creating an additional field.

                                   

                                  Thanks,

                                  Christine

                                  • 14. Re: Date calculation
                                    cdcreek

                                    Thanks Christine.  I will try that too.  Is it possible to make the 15 day part of your recommendation  a variable that comes up as part of a show dialog routine?  Is there a book or DB that has sample scripts available.  I am working through the FileMaker reference books but most of their examples are not relevant to my situations.

                                    All the best.

                                    Chris

                                     

                                    Sent from my iPad

                                    1 2 Previous Next