partsgb.martinw Posted September 2, 2000 Posted September 2, 2000 I am trying to find a way to search between two dates. ie. from the beginning of a month to the end of the month. The search would be inputed by person doing the search. However the search dates would be any date that is inputted.... I would like to have two fields to do the search. first field would be the begin. second field would be the end. Please could anyone help me on this one. Many Thanks, Martin Williams
geod Posted September 2, 2000 Posted September 2, 2000 The short way would be to: 1) Create 2 Global Date fields: gDate_Begin and gDate_End and 1 Gobal Text field: gDate_Range. 2) Create a calculated field: cDate_Range with the following calculation: DateToText(gDate_Begin) & "..." & DateToText(gDate_End) This would yield by example: 10/1/2000...12/31/2000, the corrent format for entering a date range in a date field while in find mode. 3) Create a form call it: Date Select. Put the 2 Global Date fields and the calculated field cDate_Range on the form. The first two will allow you to enter the begin and end dates for your find and when you click outside of the two fields you can see the range created in the field cDate_Range. Put 2 Buttons on the form. One saying Cancel and one saying Continue. The Cancel button will be specified to play another script GetDatesCancel (described below) and in the Specify Button dialog box the drop down menu for "current script" must be set to Halt. For the Continue button, in the Specify Button drop down menu choose: Pause/Resume Script. 4) create 2 Scripts: first Script - GetDates AllowUserAbort [Off] SetField ( "gDate_Begin" , """") SetField ( "gDate_End" , """") GoToLayout ("Date Select") Pause/Resume Script SetField [ "gDate_Range","cDateRange"] FreezeWindow This script creates a correct date range & sets the Global Text field gDate_Range which can be accessed from within you application & the script can be called from any other script that might be performing a Find: whether for viewing or printing a report. When you enter Find mode in a find script add this script step, Set Field ["Any Date Field","gDate_Range"] whenever you want to restrict your date range to the range set in your Date Select Form. Second Script - GetDatesCancel this script could do whatever you want it to do if the user decides to press the cancel button in the Date Select Form. generally it would use the GoToLayout Step to navigate to whatever form you wanted to end up on. That is it, in the short form. There are all kinds of ways for "spiffin up" the entry of the dates into your Begin and End date fields but they require much longer explanations.
Recommended Posts
This topic is 8852 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now