7 Replies Latest reply on May 29, 2010 8:42 AM by paolobkk

    Search by range date - get(currentdate) in wrong format

    paolobkk

      Title

      Search by range date - get(currentdate) in wrong format

      Post

      I'm making up a database with daily activities and I summarize them in a list view sorted by Date.

      So I've made a script to "filter" all the list to show me the last 5 days (this script will be applied to a button).

       

      This is what I got so far:

       

      Enter Find Mode []

      Go to Object [Object Name: "SearchDate"]  - (I've named the date field like that because I have 2 around the layout)

      Insert Calculated Result [Select;(Get ( CurrentDate ) - 5 ) & "..." &  (Get ( CurrentDate ))]

      Perform Find []

       

      Everything looks good, I guess, but the script is getting the 2 dates in US format (mm/dd/yyyy) instead of the default (dd/mm/yyyy) and it stops with a message saying that the search criteria must be like dd/mm/yyyy. and it doesn't perform the find request.

       

      I'v checked the format on that date field and I also tried to set it as US format, but I still get the same error message.

       

      ...any clue?  :-/

       

      Thanks!  :)

        • 1. Re: Search by range date - get(currentdate) in wrong format
          comment_1

          Does the file have any history that includes another date format (e.g. did you create it by adapting an existing file)?

           

           


          DudeCat wrote:

           

          Go to Object [Object Name: "SearchDate"]  - (I've named the date field like that because I have 2 around the layout)

          Insert Calculated Result [Select;(Get ( CurrentDate ) - 5 ) & "..." &  (Get ( CurrentDate ))]


          Why don't you simply use Set Field [] ?

           


          • 2. Re: Search by range date - get(currentdate) in wrong format
            paolobkk

            I have 1 date field in the header and 1 date field in the subsummary part and I want the search to be in the header only, that's why I named the one in the header "SearchDate".

            I've tried to use also the Set Field[] but the result is the same.

             

            The problem is that, for example, if I make a simple script with "perform find" and I make as search criteria "//" it works just fine and I get the today date list (dd/mm/yyyy).

            But on "get (currentdate) it comes with the US date format (mm/dd/yyyy).

            I've checked the date format in that field in different ways but nothing...

             

            **I forgot to mention, I use Filemaker 11 on windows 7

             

            Thanks for reply, I'm newbie and I've been a user of FM for 7 years but I got on programming just 6 months ago, learning on books and videos of John Mark Osborne, :smileyhappy:

            • 3. Re: Search by range date - get(currentdate) in wrong format
              comment_1

               


              DudeCat wrote:

              I have 1 date field in the header and 1 date field in the subsummary part and I want the search to be in the header only,


               

              The search takes place in the table, not on the layout. If you have two instances of the same field on a layout, it doesn't matter which one is used to enter the criteria. Set Field[] works directly on the data level, and doesn't require the field to be on the layout at all.

               

              You haven't answered my question re the file's history.


              • 4. Re: Search by range date - get(currentdate) in wrong format
                paolobkk

                ok, thanks for the "opening eyes" about the search.

                 

                The file is totally mine from the very beginning, doesn't have any old file piece or script coming from other files.

                 

                Actually when I started to make this search script I had only one date field and I was working on that field only.

                Then I've created the second one as a test (mostly) to see if by changing the format of this second field by US format was going to work.

                • 5. Re: Search by range date - get(currentdate) in wrong format
                  comment_1

                  Formatting a field instance on a layout has no bearing here. I would suggest you try the following:

                   

                  1. Make sure your OS short-date format is set to DD/MM/YYYY.

                  2. Save a copy of your file as clone (no records).

                  3. Close your file, open the clone and import records from the original file.

                  • 6. Re: Search by range date - get(currentdate) in wrong format
                    paolobkk

                    well...I can't thank you enough,

                    I just remade the script using Set Field[] instead of "Go to object and insert calculated result", I took off the second extra date field from the layout and it worked like a charm! :smileyvery-happy:

                     

                    yet I still don't get why with the "insert calculated result" it comes up with the US date format....  mysteries of pc I guess.. hehe

                     

                    Thanks again!:smileywink:

                     

                     

                    • 7. Re: Search by range date - get(currentdate) in wrong format
                      paolobkk

                      Checking the short date format in my OS was one of the first thing I did, but it was already ok (dd/mm/yyyy).

                      but I'll try to make a test with a clone of the file without any record, just to make sure.

                       

                      it seems like is changing format only when I "insert calculated result" using "get (CurrentDate)" ,  (no problems with // or set field[]).