![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am using FMP 10 on Windows XP. I have many records that all have a date field. I have the fields sorted by date. As I move ahead or back record by record, I would like to place a script/button on the layout that would take me back to today's date. I do not want to do a find and enter //. That will take me to the current date but I will not see the rest of the records. I see "GO TO RECORD" as a script possibility but the only choice that seems to work is a Calculation but you have to enter something that comes back as a Number. What am I doing wrong? What can I enter as a script to continue to show all records and in the order they are sorted but just go to the record with today's date??? |
#3
| |||
| |||
|
|
On 2010-01-02 16:34:44 -0800, "Stephen Larivee" <lariveesl (AT) yahoo (DOT) com said: I am using FMP 10 on Windows XP. I have many records that all have a date field. I have the fields sorted by date. As I move ahead or back record by record, I would like to place a script/button on the layout that would take me back to today's date. I do not want to do a find and enter //. That will take me to the current date but I will not see the rest of the records. I see "GO TO RECORD" as a script possibility but the only choice that seems to work is a Calculation but you have to enter something that comes back as a Number. What am I doing wrong? What can I enter as a script to continue to show all records and in the order they are sorted but just go to the record with today's date??? Since you have FM10, you can have a script that on entering that screen, finds the record with today's date, and then stores the record number in a global variable. Then you can use GoToRecord using that variable in place of the record number calc. If the current-date record isn't in the found set, or if you resort or refind after the above script runs, though, it will fail. More robust but far slower if there are large record counts is a looping script. Pseudocode: Go to Record [first] Loop Exit loop If (Datefield = Get(Currentdate)) Go to Record [next, exit after last] End Loop If your current date record is near the top in your sort order, this could be very fast. If it's 5000 records down, not so fast. If the record is not in the found set, it's still going to fail. You might want to include a Show All Records and a Sort in there, if that won't screw up your purposes in being on that screen. Faster and something that will ignore found sets is setting the current date into a global field, then making a relationship from the global to your DateField. GoToRelated Record using that relationship will get you there instantly. Dont' click "show only related records" and it won't disturb your sort order. -- Lynn Allen -- www.semiotics.com Member FBA FM 10 Certified Developer |
![]() |
| Thread Tools | |
| Display Modes | |
| |