steigrafx Posted March 7, 2013 Posted March 7, 2013 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
Lee Smith Posted March 7, 2013 Posted March 7, 2013 Deselect the "Restore" in the script step and see that does it for you.
steigrafx Posted March 7, 2013 Author Posted March 7, 2013 Thanks for the reply, Lee. I don't see how to deselect "Restore" without unchecking "Specify find requests."
dansmith65 Posted March 7, 2013 Posted March 7, 2013 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
steigrafx Posted March 7, 2013 Author Posted March 7, 2013 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
dansmith65 Posted March 8, 2013 Posted March 8, 2013 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.
steigrafx Posted March 8, 2013 Author Posted March 8, 2013 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
steigrafx Posted March 8, 2013 Author Posted March 8, 2013 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
steigrafx Posted March 9, 2013 Author Posted March 9, 2013 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
dansmith65 Posted March 10, 2013 Posted March 10, 2013 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.
steigrafx Posted March 10, 2013 Author Posted March 10, 2013 Thank you, Dan, I'll change the script. Have a great day. Kevin EDIT: Just tried it. Works like a charm. Thanks again.
Recommended Posts
This topic is 4668 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now