4 Replies Latest reply on Sep 4, 2016 2:07 PM by wfwagoner2

    "Close File" - Necessary or not?

    wfwagoner2

      Ok..... I have some questions that I have yet to see posted anywhere so either I am totally in the dark or needlessly worrying. So...here goes!   Just finished a rather complex application that utilizes a "core" of fifteen primary databases (and a LOT of links, both 1:1 and 1: many) that necessitate a lot of "in and out" traffic between the databases, sets, etc. The scripts calls are many - I utilize a LOT of on-screen buttons. I noticed that on occasion, some of the script calls stopped working. For example, on a simple "Return Home" button that just places the user back on the Main Menu. Simple script really...just opens the Main Menu. Interesting thing though, there were ELEVEN OTHER COPIES of the HOME SCREEN also "OPEN" at the same time....all numbered of course. I hadn't thought of this before...

      Should I make it a habit of using the "Close Flie" scenario to avoid this or is this a non issue??? Am I nuts or what???????

        • 1. Re: "Close File" - Necessary or not?
          philmodjunk

          "Database" is a fuzzy term in FileMaker land. What do YOU mean by it?

           

          Do you have multiple files open are are you simply referring to multiple tables or maybe just multiple windows?

           

          And it appears that you are ending up with multiple windows open--that's something that can be managed by closing windows or having your script check to see if a window of a given name is already open before actually opening that extra window instead of just selecting it to bring it to the front.

           

          Not IsEmpty ( FilterValues ( WIndowNames ; "Menu" ) )

           

          will evaluate as True if a window named "menu" is currently open.

          1 of 1 people found this helpful
          • 2. Re: "Close File" - Necessary or not?
            BruceRobertson

            I agree with philmodjunk that you're being quite vague; and it sounds like you are using lots of files when there is no need to do so.

            You can have multiple TABLES within a single file and generally that is the much preferred way to go.

            In any case, let's say your MENU layout is in the "Contacts" file. (Maybe it is in the "MENU" file?)

             

            In that file, create a script MENU which includes the following:

            Go to Layout [ Menu ]

            View as Form

            Adjust window [ resize to fit]

             

            Rather that "Open MENU" as you are doing now from all your other files, they should call this script.

             

            Perform Script [ "MENU" from file:  "Contacts"]

            1 of 1 people found this helpful
            • 3. Re: "Close File" - Necessary or not?
              PowerSlave

              This is a common problem that many FileMaker developers will come across at some stage when using new windows within their databases. I find the best way to handle  this is to 'clean up' those open windows from time to time.

              You can try this - create the below script and call it whatever you like, then set a script trigger to run the script on your menu layout 'On layout enter' :

               

              #Close all other windows except 1

              Set Variable [ $wn; Value:WindowNames (Get ( FileName ))]

              Set Variable [ $wc; Value:ValueCount($wn)]

              If [ $wc > 1 ]

                   Set Variable [ $c; Value:1]

                   Loop

                        Close Window [ Name: GetValue($wn ; $c); Current file ]

                        Exit Loop If [ $c = $wc -1 ]

                        Set Variable [ $c; Value:$c + 1]

                   End Loop

              End If

              Exit script [True]

               

               

              • 4. Re: "Close File" - Necessary or not?
                wfwagoner2

                I will try this approach when time permits. Thank You!