10 Replies Latest reply on Jan 25, 2013 7:01 AM by philmodjunk

    Date Range Script

    SeanSarjoo

      Title

      Date Range Script

      Post

           Hi, Im trying to setup a Date Range Find without uch success..

           so far i followed this posting http://help.filemaker.com/app/answers/detail/a_id/5912/kw/finding%20a%20date%20range

           and i am stuck on this part.

           Go to Layout ["Layout #1"]
           Enter Find Mode [ ]
           Set Field [ADateField ; ExampleTable::GlobalStartDate & "..." & ExampleTable::GlobalEndDate]
           Perform Find [ ]

           When i do the Set Field i get an error asking me to add operators..

           Here is what i have done

           Set Field   Exam Info::Date of Service;Exam Info::Global Start Date  & "..." & Exam Info::Global End Date]

            

           Any help would be appreciated

        • 1. Re: Date Range Script
          symbister
           If you typed exactly as you posted, you've missed out the first square parenthesis and all those spaces in field names are very unwise...
          • 2. Re: Date Range Script
            SeanSarjoo

                 When i try to add the first square parenthesis i get an error

                 It says " A number, text constant, field name or "(" is expected here.

                 What type of problems should i expect from spacing between field names.

            • 3. Re: Date Range Script
              symbister
               In general - it is not good practice to have spaces in field names, table names, layout names etc. - amongst other things it makes debugging easier later - use underscores "_" or just join the words together You shouldn't need to 'add' the square parenthesis, in the script step, selecting Set Field already formats with the [] ready for you to fill in, you may be trying to add additional ones?
              • 4. Re: Date Range Script
                symbister
                 and pardon the stream of consciousness - for whatever reason starting a new paragraph in my post answer window has no effect on the finished post
                • 5. Re: Date Range Script
                  Abhaya

                       Hi sean,

                       please follow the below points

                       Set Field [Exam Info::Date of Service;BExam Info::Global Start DateB&B"..."B&BExam Info::Global End Date]

                       Please make sure the alphabate (B)placed in the above script does not have any space at that place.

                       hope you got this.

                  • 6. Re: Date Range Script
                    Sorbsbuster

                         You should not have to do any of that typing.  It is a script step, 'Set Field'.

                         When you select that script step there are two options at the bottom right:

                    to select the field to set
                         Click the button and choose the right field from the list that pops up.  Make sure ytou choose the correct table occurance.  If you design the script when on the right layout for the field's table occurance it should default to that.

                    to select what the field should be set to
                         Click the second button and build the calculation, just as you would with a calculation field.  You can have spaces (and returns) as they often make the calculation easier to build and check.
                         It might look like:

                         ExampleTable::GlobalStartDate & "..." & ExampleTable::GlobalEndDate

                         There will be no square brackets - the script will add those, purely for display purposes, when you exit the step.

                    • 7. Re: Date Range Script
                      SeanSarjoo

                           Ok, I was able to get rid of the errors while creating the script.. However when i do run the script.. it goes to the date field, but there is no range there and when it tries to perform the find.. it gives an error that no information is given to find..

                      • 8. Re: Date Range Script
                        Sorbsbuster

                             Your typed script shows that you unticked the option (to restore Find requests) at the 'Perfom Find' script step.  That is indeed what you should do - but did you do that in the actual script?

                             Are you sure that the name of the field on the layout (and its Table Occurance) is exactly the same as the field you are specifying in the 'Set Field' script step?

                             I suggest you put a 'Pause Script' step just before the Perfrom Find, and you will see how it has set the value.

                        • 9. Re: Date Range Script
                          SeanSarjoo

                               There wasnt an option to untick the restore Find request,

                               I put the Pause in,, the script ran up to the calculation and gave me an error " The provided find criteria is not valid. Enter a valid request before proceeding"

                               It doesnt seem to be entering any information into the Date of Service field, I did try it manually by entering the 2 dates in and it performed the find.

                                

                                

                          • 10. Re: Date Range Script
                            philmodjunk

                                 Make sure your two global date fields are:

                                 Truly global (Check storage in field options)

                                 Fields of type date (check field types in Manage | Database | Fields )

                                 Contain dates