![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am using FMP7. I have a field called DATE. I have several years of dates. I would like to have a script that will sort by date and then go to today's date. I believe I used to use a Today function but I don't see it listed in FMP7. What do I need to do? |
#3
| |||
| |||
|
|
Use rather 'Get( CurrentDate )', like this script line: SetField( GlobalDateField, Get( CurrentDate )) Remi-Noel "Stephen Larivee" <NOlariveeslSPAM (AT) yahoo (DOT) PLEASEcom> a écrit dans le message de news: zKWdnXwvtcVgh7beRVn-hQ (AT) comcast (DOT) com... I am using FMP7. I have a field called DATE. I have several years of dates. I would like to have a script that will sort by date and then go to today's date. I believe I used to use a Today function but I don't see it listed in FMP7. What do I need to do? |
#4
| |||
| |||
|
|
Use rather 'Get( CurrentDate )', like this script line: SetField( GlobalDateField, Get( CurrentDate )) Remi-Noel "Stephen Larivee" <NOlariveeslSPAM (AT) yahoo (DOT) PLEASEcom> a écrit dans le message de news: zKWdnXwvtcVgh7beRVn-hQ (AT) comcast (DOT) com... I am using FMP7. I have a field called DATE. I have several years of dates. I would like to have a script that will sort by date and then go to today's date. I believe I used to use a Today function but I don't see it listed in FMP7. What do I need to do? |
#5
| |||
| |||
|
|
Remi, I am having some problems with the script I wrote: Set Field [Plan Book:: Date; Get (CurrentDate)] Show all records Sort (no dialogue) The file is Plan Book and the date field is simply called Date. The problem is that when I run this script, some of the dates on the other records are being changed to the current date! I deleted all records but three. I had a record for yesterday, today and tomorrow. When I ran the script, hoping to go to the middle record (today's date), I found that one other record had its date changed to the current date. I had one record for yesterday and two for today. I continued to run the script and ended up with all three records with today's date. I was hoping NOT to change any dates but simply go to the record that had a date matching today's date. Where did I go wrong??? |
#6
| |||
| |||
|
|
Stephen Larivee wrote on (9/17/2005): Remi, I am having some problems with the script I wrote: Set Field [Plan Book:: Date; Get (CurrentDate)] Show all records Sort (no dialogue) The file is Plan Book and the date field is simply called Date. The problem is that when I run this script, some of the dates on the other records are being changed to the current date! I deleted all records but three. I had a record for yesterday, today and tomorrow. When I ran the script, hoping to go to the middle record (today's date), I found that one other record had its date changed to the current date. I had one record for yesterday and two for today. I continued to run the script and ended up with all three records with today's date. I was hoping NOT to change any dates but simply go to the record that had a date matching today's date. Where did I go wrong??? Where did you get the Show All Records idea from? That's in effect the exact opposite of a find. In the script, you need only: Go To Layout [ Whatever ] Perform Find In the Specify Find Requests dialog, select your date field. Under Criteria, you can use the Insert Symbol button to enter // (today's date) or you can just type in two slashes. Click Add. Done. Matt |
#7
| |||
| |||
|
|
I don't want to do a find. I want to have all records sorted by date and have the record shown to be the record with the current date. is not 100% clear to me. |
|
"Matt Wills" <I'm (AT) Witz (DOT) end> wrote in message news:cCWWe.148$iu5.65 (AT) trndny04 (DOT) .. Stephen Larivee wrote on (9/17/2005): Remi, I am having some problems with the script I wrote: Set Field [Plan Book:: Date; Get (CurrentDate)] Show all records Sort (no dialogue) The file is Plan Book and the date field is simply called Date. The problem is that when I run this script, some of the dates on the other records are being changed to the current date! I deleted all records but three. I had a record for yesterday, today and tomorrow. When I ran the script, hoping to go to the middle record (today's date), I found that one other record had its date changed to the current date. I had one record for yesterday and two for today. I continued to run the script and ended up with all three records with today's date. I was hoping NOT to change any dates but simply go to the record that had a date matching today's date. Where did I go wrong??? Where did you get the Show All Records idea from? That's in effect the exact opposite of a find. In the script, you need only: Go To Layout [ Whatever ] Perform Find In the Specify Find Requests dialog, select your date field. Under Criteria, you can use the Insert Symbol button to enter // (today's date) or you can just type in two slashes. Click Add. Done. Matt I don't want to do a find. I want to have all records sorted by date and have the record shown to be the record with the current date. |
#8
| |||
| |||
|
|
In my post I said 'GlobalDateField' not a normal field [SetField( GlobalDateField, Get( CurrentDate ))] Like it happens often, I am not sure to see what you are after. Your sentence : I don't want to do a find. I want to have all records sorted by date and have the record shown to be the record with the current date. is not 100% clear to me. If you mean that you want to focus to (in fact 'find') the record of the 'Plan Book' file where the field 'Date' is equal to the CurrentDate, then show a layout where that record will be shown alone while all the other records are before or after this one, you need to find (locate) that record among the others. Your line "Set Field [Plan Book:: Date; Get (CurrentDate)]" will fill the Date field where you are presently and replace its previous contents. So, you have first to find (or locate) the good record and stay there. Two ways to do that : 1) you script a sort on Date of all records, then you do a 'find' of the record in which 'Date' is equal to the current date, then you 'Find All'. 2) you make a self-relationship with on the left my 'GlobalDateField' once filled with the current date, and on the right the 'Date' field. Your script will then 'Go to the Related record'. (by the way, it is not a good idea to name the fields with names that are exactly spelled like existing FileMaker functions: 'Date' is an FMP function). Now, if you need it, I can make an example for you but I'll need a real address to send it. Remi-Noel "Stephen Larivee" <NOlariveeslSPAM (AT) yahoo (DOT) PLEASEcom> a écrit dans le message de news: _pKdnaWCNoRN2LHeRVn-tw (AT) comcast (DOT) com... "Matt Wills" <I'm (AT) Witz (DOT) end> wrote in message news:cCWWe.148$iu5.65 (AT) trndny04 (DOT) .. Stephen Larivee wrote on (9/17/2005): Remi, I am having some problems with the script I wrote: Set Field [Plan Book:: Date; Get (CurrentDate)] Show all records Sort (no dialogue) The file is Plan Book and the date field is simply called Date. The problem is that when I run this script, some of the dates on the other records are being changed to the current date! I deleted all records but three. I had a record for yesterday, today and tomorrow. When I ran the script, hoping to go to the middle record (today's date), I found that one other record had its date changed to the current date. I had one record for yesterday and two for today. I continued to run the script and ended up with all three records with today's date. I was hoping NOT to change any dates but simply go to the record that had a date matching today's date. Where did I go wrong??? Where did you get the Show All Records idea from? That's in effect the exact opposite of a find. In the script, you need only: Go To Layout [ Whatever ] Perform Find In the Specify Find Requests dialog, select your date field. Under Criteria, you can use the Insert Symbol button to enter // (today's date) or you can just type in two slashes. Click Add. Done. Matt I don't want to do a find. I want to have all records sorted by date and have the record shown to be the record with the current date. |
#9
| |||
| |||
|
|
Thank you, once again. I am printing your directions and will try again. "Remi-Noel Menegaux" Now, if you need it, I can make an example for you but I'll need a real address to send it. |
#10
| |||
| |||
|
|
Stephen, it may be tricky sometimes, so don't hesitate to ask me for an example. Remi-Noel "Stephen Larivee" Thank you, once again. I am printing your directions and will try again. "Remi-Noel Menegaux" Now, if you need it, I can make an example for you but I'll need a real address to send it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |