dbTalk Databases Forums  

go to today's date (script)

comp.databases.filemaker comp.databases.filemaker


Discuss go to today's date (script) in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stephen Larivee
 
Posts: n/a

Default go to today's date (script) - 09-16-2005 , 02:20 PM






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?



Reply With Quote
  #2  
Old   
Remi-Noel Menegaux
 
Posts: n/a

Default Re: go to today's date (script) - 09-16-2005 , 03:32 PM






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...
Quote:
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?




Reply With Quote
  #3  
Old   
Stephen Larivee
 
Posts: n/a

Default Re: go to today's date (script) - 09-16-2005 , 04:25 PM



Thank you. Worked like a charm!



"Remi-Noel Menegaux" <rnmenegaux (AT) free (DOT) fr> wrote

Quote:
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?






Reply With Quote
  #4  
Old   
Stephen Larivee
 
Posts: n/a

Default Re: go to today's date (script) - 09-17-2005 , 07:49 AM



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???



























"Remi-Noel Menegaux" <rnmenegaux (AT) free (DOT) fr> wrote

Quote:
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?






Reply With Quote
  #5  
Old   
Matt Wills
 
Posts: n/a

Default Re: go to today's date (script) - 09-17-2005 , 10:28 AM



Stephen Larivee wrote on (9/17/2005):

Quote:
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


Reply With Quote
  #6  
Old   
Stephen Larivee
 
Posts: n/a

Default Re: go to today's date (script) - 09-17-2005 , 11:35 AM




"Matt Wills" <I'm (AT) Witz (DOT) end> wrote

Quote:
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.




Reply With Quote
  #7  
Old   
Remi-Noel Menegaux
 
Posts: n/a

Default Re: go to today's date (script) - 09-17-2005 , 02:31 PM



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 :
Quote:
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...
Quote:
"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.




Reply With Quote
  #8  
Old   
Stephen Larivee
 
Posts: n/a

Default Re: go to today's date (script) - 09-17-2005 , 06:32 PM



Thank you, once again. I am printing your directions and will try again.


"Remi-Noel Menegaux" <rnmenegaux (AT) free (DOT) fr> wrote

Quote:
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.






Reply With Quote
  #9  
Old   
Remi-Noel Menegaux
 
Posts: n/a

Default Re: go to today's date (script) - 09-18-2005 , 05:23 AM



Stephen, it may be tricky sometimes, so don't hesitate to ask me for an
example.
Remi-Noel

"Stephen Larivee"
Quote:
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.




Reply With Quote
  #10  
Old   
Stephen Larivee
 
Posts: n/a

Default Re: go to today's date (script) - 09-18-2005 , 04:03 PM



Thank you. You have been most helpful.


"Remi-Noel Menegaux" <rnmenegaux (AT) free (DOT) fr> wrote

Quote:
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.






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.