1 Reply Latest reply on Jul 12, 2012 9:13 PM by philmodjunk

    Using begin date and end date to show a list of records in a report

      Title

      Using begin date and end date to show a list of records in a report

      Post

      I have a report of shipping data (We'll call it "ShippingReport") which includes a field named, "ShipDate".

      I want to be able to create a button on a "Main Menu" layout, not on the actual report which, when the user clicks on the button, they are requested to enter a beginning date followed by an ending date.

      The result of the above needs to open the report showing only those records that contain a ShipDate between the two dates (inclusive of the two dates entered).

      I'd appreciate help in creating a script to attach to the button which will perform the above task.

        • 1. Re: Using begin date and end date to show a list of records in a report
          philmodjunk

          Define two fields with global storage specified. You can define them in any table in your database. I'll call them Globals::gDate1 and Globals::gDate2

          Show Custom Dialog ["Please enter two dates" ] //specify Globals::gDate1 and Globals::gDate2 as the input fields for the dialog.
          If [ Get ( LastMessageChoice ) = 1 // Ok was clicked ]
              Go to Layout ["ShippingReport" ( ShippingData ) ]
              Enter find mode [] //clear the pause check box
              Set Field [ShippingData::ShipDate ; Globals::gDate1 & "..." & Globals::gDate2 ]
              Set Error Capture [on] // keep "no records found" dialog from interrupting the script
              Perform Find []
              Sort Records [No dialog ; Restore ] //sort records if necessary for your report
          End IF

          You may also want to consider designing a layout with the two globals fields instead of using show custom dialog. You can then enter the two dates and click a button to start the above script. This allows you to enforce valid date formats at the time the user enters dates. If you use the New Window script step, it is possible to open a "dialog box" with your own layout design.