1 2 Previous Next 16 Replies Latest reply on Jul 18, 2015 11:03 PM by MattStephens

    Add Current Date!

    FarfelKnabe

      Title

      Add Current Date!

      Post

      Hi all,

      To add the current date into a field using either the insert function on the shortcut menu or having a button do it for you, is easy enough if the field is empty (because I can only add a new date that overwrites any data in that field) - but how do I add the current date to a field that already has a entered value(s) and I want to keep that - just adding the newest current date into the field!

      If possible I would like to add the date to the top of the field or least by where the cursor is in the field!

      /A

        • 1. Re: Add Current Date!
          Sorbsbuster

          Create a script that sets the field to itself, with the date added at the top.  Eg:

          Set Field (MyTextField; Get (CurrentDate ) & "¶-----" & MyTextField )

          • 2. Re: Add Current Date!
            philmodjunk

            The insert current date script function can be used to insert the current date at the current cursor position.

            However, entering multiple dates into the same field often indicates a situation where a portal of related records with one date per portal row is a better design option.

            • 3. Re: Add Current Date!
              FarfelKnabe

              Hi!

              Thanks for the replies, but when I try to do the suggested "Set Field" script I run into an error "This function cannot be found."

              I change the MyTextField examples to the name of my field, a date field named "Test Dates".

              Am I missing something or I is just me being to much of a newbie!

              /A

              • 4. Re: Add Current Date!
                philmodjunk

                What part of your expression is highlighted when you get that error message?

                • 5. Re: Add Current Date!
                  FarfelKnabe

                  Set Field is highlighted!

                  /A

                  • 6. Re: Add Current Date!
                    philmodjunk

                    Where did you type in Set Field? This isn't something you can use in a calculation definition for a field.

                    This is a script step, you should open Manage | Scripts... start a new script and add Set Field to this script by double clicking Set Field in the list of script steps shown on the left.

                    • 7. Re: Add Current Date!
                      Sorbsbuster

                      Are you typing 'Set Field' into the calculation box?  (You shouldn't be.)

                      • 8. Re: Add Current Date!
                        FarfelKnabe

                        I did type the Set Field parameter into the calculation box!

                        Is the script example given by Sorbsbuster really working without doing anyting other than enter that into the calculation box? Because I only recieve an error message promting that the calculation is missing a operator?

                        MyTableName::MyFieldName;Get (CurrentDate ) & "¶-----" &MyTableName::MyFieldName

                        The error message on a missing operator highlight just in front of the Get command! I have tried a few but can't seem to get it right and since I am really new with scripts I would really appreciate some help, please!

                        /A

                        • 9. Re: Add Current Date!
                          Sorbsbuster

                          Sorry - I was trying to show the steps to complete that script line.

                          Choose the Script Step 'Set Field'

                          You will see two boxes bottom right: Specify target field and Calculated Result.

                          Click on Specify target field and choose the field you are wishing to add the date to.

                          Click on Calculated Result and enter Get (CurrentDate ) & "¶-----" & MyTableName::MyFieldName [choose the same field from the field list above the calculation box)

                          When you click OK the script step will look a bit like I originally typed:

                          Set Field (MyTextField; Get (CurrentDate ) & "¶-----" &  MyTextField )

                          • 10. Re: Add Current Date!
                            FarfelKnabe

                            Ok that's clearer, thanks alot for clarifying that :)

                            I have tested it and the sctipt, applied to a button next to the field, actually works :) Must the field be a date field, or can it be a text field? It looks like this when applied?

                            2011-01-27
                            -----

                            If I have text (other dates) in the field it looks like this

                            2011-01-27
                            -----2001-01-01
                            1998-02-25

                            (the dates just being random dates right now)

                            Is there a need for the dashes or can those be taken out of the calculation? I tried this and it seems to work, great :) But I still don't understand all of it so that's why I am asking all of the questions.

                            Thanks for the great and quick help here guys :)

                            /A

                            • 11. Re: Add Current Date!
                              Sorbsbuster

                              The dashes were just because I usually want to have a separator when I build up a log.  So it goes from this:

                              20/01/2011 Sent letter to Client about unpaid invoice

                              to this:

                              23/01/2011 Client phoned to ask for copy of original bill

                              ---

                              20/01/2011 Sent letter to Client about unpaid invoice

                              You can leave out the dashes if you want.  (Although I'm curious why all it will be is a list of dates.  Sounds to me like something begging for an attached explanation, or another table with Child Records of those dates.  But, no matter.)

                              • 12. Re: Add Current Date!
                                Sorbsbuster

                                Sorry to answer you other question, if you are going to make it into a list of dates, it must be a text field.  There is no such date as:

                                2011-01-27
                                2001-01-01
                                1998-02-25

                                • 13. Re: Add Current Date!
                                  FarfelKnabe

                                  Thanks guys for the effort with this problem of mine. You have actually helped me more than you can imagine :)

                                  I am a avid movie collector and I am watching movies most every day and I have begun to test out Filemaker if that program can be a replacement for the outgrown DVD collecting software I have been using for the last couple of years. In this software there is of course a value to enter whenever a DVD title was being viewed, but only the one date and no way to keep track on those titles one watched multiple times!

                                  I have time after time mailed the producers of the software about this wish of mine and they can't seem to understand the need and want for one collector to keep track on the history on the different viewing dates!

                                  I have in this test period of Filemaker, going first to Bento on a recomandation from my brother-in-law (but after testing Bento realizing that Bento is to "small" for me and my purposes with a database) discovered that Filemaker can actually be the program I move my collection over to.

                                  With this simple script, attached to a button, the decicion to move had become much easier :) and when I learn more and more for each week that goes by I can do more automated stuff with my collection data, such us adding a counter to the Viewing Date field that count the number of occurences/lines/dates and present them in a seperate field (e.g. # times seen) - any suggestions on that?

                                  Just wonderful these small enjoyments in life :) thanks again guys.

                                  Now I am going to continue to work on the design of the database...

                                  /Andreas

                                  • 14. Re: Add Current Date!
                                    philmodjunk

                                    Please look up "Portal" in FileMaker help. I think you will be much happier with a portal to a related table for logging your viewing times. It's much more flexible and much easier to implement.

                                    With this tool, you can get a 'mini table' of viewing dates with each date on a separate row in the table.

                                    1 2 Previous Next