You are not clear on your posting. Your script only search for the current date not the previous date. If the above script is having problems finding the current date then I would suggest looking at your scheduled field and make sure it is of type date. To also search for the previous days date then you will need to add to your script after your set field statement and before your perform find statement you would add a new/record request and then another set field statement with Get(CurrentDate)-1.
Thank you for your response. I have double checked and the field type is Date. I am only trying to search for the current date, but somehow it is finding both current and the day before.
Not all script details are visible in your retyped script. Can you post an exact copy?
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 New 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. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- 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.
Here is the actual script, not the retyped version. I am beginning to think my issue is more with my relationships than with this script. But if you happen to spot an error in this script, I would appreciate the heads up.
Set Error Capture [On]
Go to Layout [ “Print List Bills” (mb_MASTERDATA) ]
Enter Find Mode [ Specified Find Requests: Find Records; Criteria: mb_SHEDmd::Scheduled: “//” ] [ Restore ]
Perform Find [ ]
If [ Get(FoundCount) =0
Show custom dialogue ["no records found, Click OK to return to the report creator"]
Go to Layout ["Reports"]
Sort Records [ Keep records in sorted order; Specified Sort Order: mb_SHEDmd::Scheduled; ascending mb_MASTERDATA::CompleteBillNo_Web; ascending ] [ Restore; No dialog ]
That's not even the same script. You sure you posted the correct script?
And as I suspected, your relationships and table occurrence context is probably the issue here.
The table occurrence specified for your layout is:
That makes this table occurrence your "context". Any records found by your script are records from this occurrence's data source table.
But the search criteria that is specified is from a table occurrence named:
This means that you are telling FileMaker to find all records from mb_MASTERDATA that have at least one related record from mb_SHEDmd with today's date. Once the find is performed, however, you return to Browse mode and all related records from mb_SHEDmd will be visible for the records from your found set, both those that have today's date and those that do not.
It is entirely possible that you should be performing this find on a layout based on mb_SHEDmd.
Thank you for your insight. I indeed needed the layout to reflect the correct TO. It works now like a charm. Thank you for helping me see the forest for the trees.