2 Replies Latest reply on Dec 16, 2010 9:57 AM by thong127

    Searching a date range

    AndrewClarkson

      Title

      Searching a date range

      Post

      I've looked through all the forums and manuals but I can't seem to answer this question which seems so easy.

      I'm trying to find records between two timestamps, which the user will enter as global fields ( I assume this is the best way to do it).

      So basically the user enters the start and finish timestamps into two separate fields, and then clicks a button which opens a new layout with the results showing only records with a timestamp within the desired range. Is this possible?

      Thanks

        • 1. Re: Searching a date range
          ninja

          Howdy,

          First, trap the fields that the user enters into variables, then do a find for a date range...

          Set Variable [$startdate ; Value: StartDateField ]
          Set Variable [$enddate ; Value: EndDateField ]
          Enter Find Mode
          SetField [YourDateField ; $StartDate & "..." & $enddate]
          Perform Find

          The first two trap the values entered by your user
          Then in Find mode, you set the criteria you are looking for.

          The thing I think you are looking for is the "..." which tells FMP that you are looking for a date RANGE.

          Edit: Note that if you are using global storage for your user fields, the global fields are available to you in Find mode.  This means that your script could skip the variable trapping and simply use:
          SetField [YourDateField ; StartDateField & "..." & EndDateField]
          but this would ONLY work if your two fields use global storage.

          • 2. Re: Searching a date range
            thong127

            Hello

            Try this Link then search for date search.