3 Replies Latest reply on Jun 9, 2014 9:59 AM by philmodjunk

    Opener script issue



      Opener script issue


           I've recently deployed FMS to serve up files to my various computers and my iPad.  I'm designing new layouts that are more suitable for the iPad. I always open my solution (multi-file) with the same initial file. In this first file I have a script that calls a second file to open  and runs a script to find certain records and has a Script Parameter. This second file also has a script to run OnFirstWindowOpen that determines the system platform and goes to the appropriate layout for the device. If I open the second file directly it goes to the correct layout. However, when the file is opened as mentioned previously it goes to the default layout for the file. It's as ifFM Go Thinks There's already a window open in the second file. Of course there isn't. 

             FMPA 13. FM Go 12

        • 1. Re: Opener script issue

               Stupid human error. Not worth mentioning. No replies needed.

          • 2. Re: Opener script issue

                 Been there. Done that. Have a closest full of that particular type of shirt....

            • 3. Re: Opener script issue

                   Just as an example of "been there, done that", I'm including the following post "just for laughs" as I had to stop and laugh at myself once I stopped pulling what little hair that I have left out with both hands in "self induced" frustration just this weekend:

                   I was setting up a small FM GO DB for use with managing the family budget. It has a very simple design set up. Each time a shopper ads an item to the shopping cart, you create a new record and enter it's price. A total for the entire cart is computed and deducted from a "budget" amount to tell the user the total cost of the items in the shopping cart and what impact the total purchase will have on the family finances. When you get to the cash register and the purchases are totaled up, you can use a popover to enter the actual total purchase (which will include sales tax and possible differences between the value entered and the value scanned...), and the total is "adjusted" to deduct the final total from the "budget amount" then you can take a picture of the receipt for insert into a container field.

                   The final step is to tap a button that looks like a mail box in order to save a copy of the file and email it so that I can then import that data into the full up budget system for both record keeping and more detailed cost analysis (by looking at the items on the receipt.)

                   So I have everything pretty much in place and I tap that button to send the email. I send the email to myself, my iPhone alerts to tell me email is received, but there's no attached copy of the file.

                   I can't run this in the Debugger on my iPhone, so I start inserting some show custom dialog steps to see what data is being computed as the $Path variable and also returning any error codes generated by different script steps. First thing that I notice is a "duh" error of introducing illegal characters via Get ( CurrentTImeStamp ) to the file name. That's easy to fix, but the script STILL fails to send out an email.

                   So I start looking at the $Path calculation. When there's a problem, start simplifying until it works, then add the details back in one at a time is one my standard debugging methods so I start doing that. But even with the simplest possible $Path variable Save A Copy as simply isn't saving any copy of the file!

                   Then I took a closer look at the error code returned from Save A Copy As: 3. This error, when looked up in FileMaker Help reads: "Command is unavailable (for example, wrong operating system, wrong mode, etc.)" That had me truly puzzled and frustrated as this is just a simple standard script step that is FM GO compatible... Arrrgh!!

                   Then I realized the simple goof messing this up. I was using my lap top to host the database while connecting to it with my iPhone as a client of the hosted database as a quick way to test the database while developing it and making frequent changes to the design on my laptop. And Save A Copy As... is not a script step that is available in Go or Pro when run from a Client of a Hosted database. blush

                   Once I copied the file to the iPhone and tested it--in the very environment that I intended for this to work, the script as I had originally written it save the fix to remove illegal characters, worked correctly.

                   So in the spirit of "Been there. Done that. Both that T-shirt", this was the latest "shirt" to add to a very extensive collection of the same...cool