4 Replies Latest reply on Aug 15, 2014 1:29 AM by AvrilSouthon

    Can't get date range script to work

    AvrilSouthon

      Title

      Can't get date range script to work

      Post

           Hello I have written a script so we can enter date ranges via global fields that are on a separate layout. The first script going to the global date layout works. The 2nd script going to the data layout where I want to run a report by date ranges isn't.

           I keep getting an error message " the provided find criteria is not valid". I have been through all the posts and can't find where I am going wrong. It would be great if you could help.

           It gets better - I can't seem to copy and paste the script even with FM so am typing it here: 

           Enter Find Mode []

           Perform Find []

           Set Field [Quote Information::Date Quote Accepted ; Quote Information::GlobalStartDate & "..." & Quote Information::GlobalEndDate]

           Enter Preview Mode

           Sort Records by Filed [Ascending; Quote Information::Date Quote Accepted]

            

           The script stops on the Date Quote Accepted Layout on the wrong field with the error message

           I am also trying to do a manual sort as it doesn't seem to want to do that either

           Once this is working I then need to get the Date Range on my Report Heading - some help with that would be great once this has been sorted

           thanks for your help

           Cheers

           Avril

            

            

           Cheers

           Avril

                

        • 1. Re: Can't get date range script to work
          philmodjunk

               You appear to have your script steps in incorrect order.

               Try this variation:

               Enter Find Mode []

               Set Field [Quote Information::Date Quote Accepted ; Quote Information::GlobalStartDate & "..." & Quote Information::GlobalEndDate]

               Perform Find []

               Sort Records by Filed [Ascending; Quote Information::Date Quote Accepted]

               Enter Preview Mode

               For more examples of scripted finds, see: Scripted Find Examples

               To post a script to the forum:

                 
          1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
          2.      
          3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
          4.      
          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          6.      
          7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
          • 2. Re: Can't get date range script to work
            AvrilSouthon

                 thanks so much Phil - that has worked a treat.

                 To save me 3 hours of trawling through the internet would you mind telling me how can I get the date range to appear in the heading of my report?

                 Cheers

                 Avril

            • 3. Re: Can't get date range script to work
              philmodjunk

                   Put the Quote Information::GlobalStartDate and Quote Information::GlobalEndDate fields in the header of your layout. You can use merge fields and merge text to put:

                   <<Quote Information::GlobalStartDate>>...<<Quote Information::GlobalEndDate>>

                   on your layout if you want to show the ... text. (and the above merge text can have a custom date format specified just like you would for any date field on your layout.)

              • 4. Re: Can't get date range script to work
                AvrilSouthon

                     Great thanks