March 7, 201312 yr I have a very simple startup script. When I open my database, all the steps run, except one. All the script steps run perfectly once the database is open and I trip the script manually. The line that doesn't run on startup is a simple date range find. I've tried disabling all the other steps except the find, and it still doesn't run on startup. Here's the script: View As [View as Table] Adjust Window [Maximize] Set Zoom Level [200%] Show All Records Perform Find [Restore] (Find Records, Court Calendars::Calendar Date: [1/1/2013...12/31/2013]) Sort Records [Restore; No dialog] (Calendar Date, Ascending Order) Go to Record/Request/Page [First] I can't understand why that one line refuses to run on startup, yet runs fine when I trip the script manually. Any ideas? Thanks, Kevin
March 7, 201312 yr Author Thanks for the reply, Lee. I don't see how to deselect "Restore" without unchecking "Specify find requests."
March 7, 201312 yr You don't have a go to layout script step in your start-up script, so perhaps you are not on the expected layout when the find is performed. FYI: this type of find is probably more suitable: Enter Browse Mode Set Field[Court Calendars::Calendar Date; Date ( 1 ; 1 ; Year ( Get ( CurrentDate ) ) ) & "..." & Date ( 12 ; 31 ; Year ( Get ( CurrentDate ) ) ) ] Perform Find
March 7, 201312 yr Author Thanks for the reply, Dan. I added a Go To Layout as my first script step but it didn't make a difference. I tried your script steps, but I don't understand where the calculation begins. Does it start with ( 1 ; 1 ; ? If so, I can't get it to work -- the syntax may be wrong. Thanks, Kevin
March 8, 201312 yr Here is just the calc: Date ( 1 ; 1 ; Year ( Get ( CurrentDate ) ) ) & "..." & Date ( 12 ; 31 ; Year ( Get ( CurrentDate ) ) ) Since you are using FileMaker Advanced, you should turn on script debugger before opening the file, then step through the script one step at a time.
March 8, 201312 yr Author Thanks, Dan. I'll try your script steps tomorrow when I get to my office. And how stupid of me -- it never dawned on me that I could turn on Script Debugger before opening the file. I've always used it after the file was already opened. Duh. Kevin
March 8, 201312 yr Author Dan, being the impatient person that I am, I VPN'd to my office and ran script debugger. Sure enough, I found the problem. It seems that a while ago I had set an OnLayoutEnter script trigger. It was calling a script that "undid" my startup script's find. Everything is working well now. Of course, I will try your script steps tomorrow. I'm always willing to learn something new. Thanks again, Kevin
March 9, 201312 yr Author Hi again, Dan. I tried your script, but it was leaving me in edit mode within a record, asking if I wanted to save changes. Depending upon my response, either the date field was left empty or the record was deleted. I changed the "Set Field" to "Set Field By Name" and it works perfectly. From your calculation, it appears that in 2014 it will display only year 2014 records upon startup? That would be great. Thanks again, Kevin
March 10, 201312 yr omg, another mistake in a code snippet! I need to pay more attention when I'm posting. It should be: Enter Find Mode NOT: Enter Browse Mode // this was incorrect, sorry Set Field vs Set Field by name should not matter. Yes, the script steps would search for records in the current year only.
March 10, 201312 yr Author Solution Thank you, Dan, I'll change the script. Have a great day. Kevin EDIT: Just tried it. Works like a charm. Thanks again.
Create an account or sign in to comment