Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

Solved by steigrafx

Go to solution

Deselect the "Restore" in the script step and see that does it for you.

  • Author

Thanks for the reply, Lee.  I don't see how to deselect "Restore" without unchecking "Specify find requests."

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
  • 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

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.
  • 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

  • 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

  • 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

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.

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.