I have a layout which lists details of work shifts in date order. The list is continuously growing and rather than scroll down to the current date each time I open the layout, I want it to open it as close to today as possible. I first find records which are marked as "Fillin" shifts and that occur before todays date. I then count those, perform a new find to include all "Fillin" records, sort them by date and go to the found count record. The problem is that as I add more and more records, the layout opens further and further ahead of todays date. Can anyone tell me why, or suggest a better way to achieve my goal?
I have the following scrip:
New Window [Name: "Shifts" Height etc]
Go To Layout ["Fillins" (Shifts)]
Show/Hide Status Area
Perform Find [Specified Find Requests: Find Records; Criteria: Shifts::Fillin: "=1"
Find Records; Criteria: Shifts::StartDate: "<=//"]
Set Variable [$Count; Value:Get(FoundCount)]
Show All Records
Peform Find [Specified Find Requests: Find Records; Criteria: Shifts::Fillin: "=1"]
Sort Records [Specified Sort Order: Shifts::StartDate; ascending
[Restore; No dialog]
Go to Record/Request/Page [$Count]
I am working in a Windows XP environment.