I need to find records that have a timestamp, stored in a timestamp field, that is less than the current timestamp.
I bet the answer is in this forum some place, but I cant find it.
If you're using FileMaker 11, you can use a variable in a find, so the following script will do:
- Set Variable [$criteria; Value:"<" & Get(CurrentHostTimeStamp)]
- Perform Find [Restore]
...where the find configuration references the variable, as shown below:
If you need it to work in earlier versions as well, then you'll need a slightly longer script aling the lines of:
- Enter Find Mode [ ]
- Set Field [YourFile::Timestamp; "<" & Get(CurrentHostTimeStamp)]
- Perform Find [ ]
The latter method will, of course also work in v11.
R J Cologon, Ph.D.
FileMaker Certified Developer
Author, FileMaker Pro 10 Bible
NightWing Enterprises, Melbourne, Australia
I changed the calculated timestamp into a calce number field and changed the scripted Get(CurrentTimeStamp) into a number. Works as intended now.
KylePutzier wrote:I changed the calculated timestamp into a calce number field and changed the scripted Get(CurrentTimeStamp) into a number. Works as intended now.Kyle
Not sure why you'd have been able to make it work after changing to a number format, but not while the field was in timestamp format.
FWIW, attached is a demo file that shows both the scripts from my previous post, targeting a timestamp formatted field. If you have a moment to look at the demo and compare it with your file, it might help you figure out what was stopping your script from working?!
For some reason, it would ignore the time portion of the timestamp and only find records when the date portion was < than the CurrentTimeStamp
I'll look at your demo and see f I can find what I did wrong.
Don't know. Your demo works fine. I thought It might be because I didn't have seconds in my calc'd timestamp, but that doesn't matter in your demo either.
Retrieving data ...