Are you doing this Find manually? Or by script? I assume by script.
Do not specify the Find in the Perform Find step. Try this script:
Set Variable [$StartDate ; Get ( CurrentDate ) - 30 ]
Set Variable [$EndDate ; Get ( CurrentDate ) ]
Enter Find Mode (uncheck the pause)
Set Field [YourDateField ; $StartDate & "..." & $EndDate ]
You should see that it finds all records for the last 30 days.
If your dates that spell out the date range you want to use in a search have been entered into global fields, you don't have to use variables--though it does work. You can drop the first two lines of sorbsbuster's script and modify the expression in the set field step to use the global fields instead of the variables.
Thanks for the replies. Yes it is a script in a programme that will be used by a person not really IT literate so
it has to work on a button push. The dates in question are the beginning and end of financial periods that have been preset
in a preferences table. I wondered if the fact that the end date has be an 'equal to or less than' was confusing
the issue. Will report results later today.
Try wrapping your global date field: Getastext(globaldatefield) & "...." & getastext(globaldatefield2)
In the 'OLD DAYS' we had to use insert text or some silly thing...
there is also the chance of a choke searchiing for the oldest date...newest date but I doubt this.
Getastext is not necessary for this expression. It does no harm, but isn't the cause of your trouble here.
You can always post the actual script you have set up so others can look it over for problems.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
- If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
Thanks you al for the answers and suggested changes. I must apologise for wasting your time, the problem was earlier in the
script where I had added an extra field as an intermediiary as a possible work-around the Global field issue. I am still somewhat confused about this.
The Filemaker Hep tells me that Global field may not be used in Find, yet Phil says they can be used. Directly or indirectly by using 'Enter Find Mode'
instead of a direct Find instruction?
The Help and Phil are both correct. You can use a global field as a source of a find criterion, as you have here. You cannot use a global field as the subject of a find, as by definition all records will have that value, so there is nothing to 'find' one record from another.
Yes, I fully understand that thanks, guess that I misread the Help. I think we can regard this topic as closed now.