1 Reply Latest reply on Feb 14, 2009 8:03 PM by comment_1

    loop and if scripting

    CliveB

      Title

      loop and if scripting

      Post

      I am currently teaching myself Filemaker Pro 9, learnt a bit including some script steps so far but am stuck on a test script step.

      I have 2 tables, one with a lot of data including a date field and one where the user has to enter two dates a "start date" and "end date". These two dates are to be compared in the other table so that any data less than the start date and greater than the end date will be omitted. This is eluding me completely.

      I have tried an if statement within a loop, testing whether any date in Table one is less than or greater than the dates entered in Table two.

      I receive no error condition when I save the script, but when applied I get all data from Table one with no omitions.

      Can someone out there give me a clue as to what I should do. No wisecracks accepted.

      Kind regards

      Clive B

      Melbourne

        • 1. Re: loop and if scripting
          comment_1
            

          There is no need to loop here - you could simply perform a find for records within the range.

          However, for learning purposes only, your script should roughly:

          1. Load the start and end dates into variables (unless they are entered into global fields, and thus accesible from any table);
          2. Go to a layout of the data table;
          3. Show all records;
          4. Go to the first record;
          5. Loop: If date is within the range, omit the record, else go to next record (exit after last).