3 Replies Latest reply on Feb 7, 2012 7:36 PM by philmodjunk

    Need help setting up script with date range calculation in If statement.

    outsidethebox

      Title

      Need help setting up script with date range calculation in If statement.

      Post

      Hello,

       

      I'm trying to set up an "If" statement within a new script, but I can't seem to specify the correct format in the calculation box.

      This is what I am trying to specify as calculation for "If" statement:

      Payment Entry::Auto Payment Date1  ≥ Projected Income::Beginning Date and  ≤ Projected Income::End Date

      In this calculation criteria, I am trying to test the contents of field "Auto Payment Date1" to see if this date falls within the range of "Beginning Date" and "End Date".   The calculation field does not seem to like this syntax, plus I'm not really sure that this is the correct way to find a specific date within a range of dates within the calculation box.  But I do need to accomplish this within the "If" statement of the script.

       

      Can anyone assist me on this?  It would be appreciated!

        • 1. Re: Need help setting up script with date range calculation in If statement.
          philmodjunk

          Payment Entry::Auto Payment Date1  ≥ Projected Income::Beginning Date and Payment Entry::Auto Payment Date1 ≤ Projected Income::End Date

          Is the correct syntax for an If step in a script or the first part of an If or Case function in a calculation. In either case, the key question is what should happen once this evaluates as either true or false. Basically, it tests to see if the date in Auto Payment Date1 of the current record falls in the specified date range.

          There are a number of ways to find records that fall on a date range.

          One is to use a range criteria that looks like this 2/10/2010...2/15/2010 to perform a find.

          This will find all records dated from 2/10/2010 to 2/15/2010. You'd enter find mode, enter this date range in the date field and perform the find. this can be done manually or in a script.

          Date ranges can also be used in relationships and portal filters to limit a set of related records to a specified date range. Both would use syntax based on the corrected expression I put at the top of this post.

          • 2. Re: Need help setting up script with date range calculation in If statement.
            outsidethebox

            Thanks for the quick response.  The syntax seems to be fine now, but for some reason, the IF step is still not returning a True, which it should based on the date range that is inputted and the value of Auto Payment Date1.  There must be something else wrong with the script.  I've attached the script steps that should execute after the IF step evaluates as True.  Maybe you can see something here that I'm missing.  Thanks mucho!

             

            • 3. Re: Need help setting up script with date range calculation in If statement.
              philmodjunk

              There's nothing attached to your last post.

              What is your script supposed to do? An If step with this expression does not find anything, it only tests the values of the current record.

              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 Answer.
              2. 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.
              3. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
              4. 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. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)