3 Replies Latest reply on May 4, 2014 2:06 PM by whardy7

    Scripted Find using date calculation

    whardy7

      Title

      Scripted Find using date calculation

      Post

           I'm needing to do a scripted Find using a date calculation. I have a date field LastSpeech. I need to do a Find for any records where LastSpeech > Get(CurrentDate)-90. I must be missing something simply because I cannot figure out how to enter that into the Find dialog. It won't accept calculations, only actual dates. What am I missing?

           Thank you,

           Wayne

        • 1. Re: Scripted Find using date calculation
          philmodjunk

               FileMaker stored find criteria cannot evaluate a calculated expression. But a script can enter find mode and use set field steps to enter criteria into specified fields. The calculated result parameter of set field can evaluate to produce a calculated result to use as criteria:

               Set Field [YourTable::LastSpeech ; ">" & Get ( CurrentDate) - 90) ]

               When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

          • 2. Re: Scripted Find using date calculation
            philmodjunk

                 The above example refers to scripts patterned after the examples found here: Scripted Find Examples

            • 3. Re: Scripted Find using date calculation
              whardy7

                   Good grief! I just had a brain lapse...I knew that. Thank you for reminding me. When you don't do this all the time, it seems I have to relearn some every time.

                   Thank you.