AnsweredAssumed Answered

Script to find records in Date range

Question asked by InvectusIlumni on Jul 6, 2010
Latest reply on Jul 6, 2010 by InvectusIlumni

Title

Script to find records in Date range

Post

Hi guys,

I have two scripts written to find records contained in a date range and display the found records in a report layout.

To accomplish this, two global storage fields are used: Find_StartDate and Find_EndDate to temporarely store the start and the end dates. Another date field ClockIn_Date uses the dates stored in the global fields as a search criteria.

My first script: 

New Window [Name:"SEARCH TIMESHEET"; Height:335; Width:367; Top:25; Left:25]
Show/Hide Status Area [Hide]
Go to Layout ["TIMESHEET - SEARCH" (TRANSACTIONS)] 
Enter Browse Mode []

My second script:

If [IsEmpty ( TRANSACTIONS::Find_StartDate)] 
   Show Custom Dialog ["Start Date";"Start Date must have a value. Please reenter"] 
   Exit Script [] 
End If 
If [IsEmpty (TRANSACTIONS::Find_EndDate)] 
   Show Custom Dialog ["End Date";"End Date must have a value. Please reenter"] 
   Exit Script [] 
End If 
If [TRANSACTIONS::Find_EndDate < TRANSACTIONS::Find_StartDate] 
   Show Custom Dialog ["End Start";"End Date cannot occur before Start Date. Please reenter"] 
   Exit Script [] 
End If 
New Window [Name:"SEARCH RESULTS"; Height:742; Width:850; Top:25; Left:25]
Go to Layout ["TIMESHEET - FIND" (TRANSACTIONS)] 
Enter Find Mode [] 
Insert Calculated Result [Select;TRANSACTIONS::ClockIn_Date;TRANSACTIONS::Find_StartDate & "..." & TRANSACTIONS::Find_EndDate] 
Perform Find []
Go to Layout ["PUNCHCARD - WEEKLY REPORT" (TRANSACTIONS)]

When the scripts are executed, I don't get passed passed the first layout. (first script).

Any help will be appreciated.

Outcomes