2 Replies Latest reply on Nov 15, 2010 7:40 PM by michael_1

    Date and other fixed selection script



      Date and other fixed selection script


      Hi all I have a script here which I copied from the forum posts (I'm not that bright in FM) and I want to search a selected date field and then two other fixed field entries in the one field.

      If I disable the date section the fixed selection works as expected, if I disable the fixed selection the date selection works as expected but if they are both selected the date selection doesn't. Anyone comment on how to fix my stuff up.

      Go to Layout [ “Sponsor” (Fuel report) ]
      Enter Find Mode [ ]
      Set Field [ Developer::gStart; Get ( CurrentDate )-28 ]
      Set Field [ Developer::gFinish; Get ( CurrentDate ) ]
      Show Custom Dialog [ Message: "Change date range"; Buttons: “OK”, “Cancel”; Input #1: Developer::gStart, "Enter Start Date"; Input #2:
      Developer::gFinish, "Enter End date" ]
      # If User selected 'Cancel' ... which is button 2
      If [ Get ( LastMessageChoice ) = 2 ]
      Go to Layout [ “Fuel report” (Fuel report) ]
      // Halt Script
      End If
      # Now find records according to the range
      Enter Find Mode [ ]
      Set Field [ Fuel report::Date Start; Developer::gStart & ".." & Developer::gFinish ]
      Set Error Capture [ On ]
      Set Selection [ ]
      Set Field [ Fuel report::Activation Type; "=Towing" ]
      New Record/Request
      Set Field [ Fuel report::Activation Type; "=Training" ]
      Perform Find [ ]
      Go to Layout [ “Sponsor” (Fuel report) ]

        • 1. Re: Date and other fixed selection script

          Several things you can check.

          gstart, gfinish and Date Start should all be fields of type "Date".

          At the end of your script, you set activation type to search for "Towing", then make a new request to search for "Training". This script, thus searches for all records that have the specified date range and towing, OR all records that are Training, but no date specified.

          If you want to specify the same date range for the training records, you need to put in another set field step for that after the New Record/Request step so this criteria is entered into both find requests.

          • 2. Re: Date and other fixed selection script

            Thanks for the reply. Yes the date field is date but you gave me a clue in your answer. Instead of using New record/Request which didn't work I used Duplicate Record/Request and it now does what I want it to do. I'm to used to Access Queries where you could put the criteria in one line.

            I didn't get back earlier as I was making a run time and it didn't work in that it didn't add the files but gave me no clue as to what happened. After much forum searching with no result I looked at the USB stick and a simple thing it was full.

            Thanks again