11 Replies Latest reply on Feb 22, 2012 9:27 AM by Stephen Huston

    Working With Related Data From A Closed File

    listen2earth

      _i_ just notice first time ever, the data in my portal is accessible for read and write

      when its source file is closed.

       

      _i_ suppose _i_ should test to see if the data is actually

      Saved but seems like it can't be Saved when the file is closed. Just kind of wondering

      what's going on here if theres more than what meets the eye?

       

       

      rob

        • 1. Re: Working With Related Data From A Closed File
          LyndsayHowarth

          Hi Rob,

           

          When a file accesses another file via a relationship the database is opened by FileMaker and hidden.

          So long as the file is still hidden when the main file closes, it should be closed too.

           

          See this by checking what is listed in your Window menu under Show WIndow>

           

          - Lyndsay

          • 2. Re: Working With Related Data From A Closed File
            listen2earth

            no!!! the file is actually closed!!! Residing on hard drive!!

                  

            r o b

            • 3. Re: Working With Related Data From A Closed File
              BruceHerbach

              Rob,

              Lyndsay is correct.  If the file were closed the portal would be empty.

               

              HTH

              Bruce

              • 4. Re: Working With Related Data From A Closed File
                listen2earth

                Ok yes!! Lyndsay is correct about the SHOW.

                 

                So what's with this Show Window though?

                 

                i launch my first of two related files and my 2nd related file is "NOT" launched YET but it is shown in the Show Window.

                 

                i know i should be refreshing my mind the details of this from FM basics!!

                 

                BUT clearly it IS NOT LAUNCHED cause my launch scripts have not activated!!  And my portal is showing records ?

                 

                rob

                • 5. Re: Working With Related Data From A Closed File
                  BruceHerbach

                  Ron,

                   

                  If the file is where FileMaker can find it and the table is in the graph,  FileMaker opens it for you.  That's why you see the data in the portal.

                   

                  You can verify this by closing FileMaker,  move the second file and the reopen

                  FileMaker and the primary file.   FileMaker won't find the second file and the portal will be empty.

                   

                  You should be able to close everything put the second file back and have everything work.

                   

                  HTH

                  Bruce

                  • 6. Re: Working With Related Data From A Closed File
                    Stephen Huston

                    Your File's startup script won't fire until a Window is Open for that file, not just the data having been read by the application.

                     

                    Back in the pre-FM7 days, these behaved differently, but the startup and shutdown scripts now fire on First Window Open and Last Window Closed for the file, unless the file is opened solely via a relationship or by calling a different internal script in that file from another file.

                     

                    For instance, if you actually Open the file via the Show (Window menu), then close that file, the Closing script WILL run, but it won't run at all if the Show Window is not used and nothing else causes a window to ever open for that file.

                    • 7. Re: Working With Related Data From A Closed File
                      DavidZakary

                      Files opened via a relatioship will not have their OnOpen scripts run.

                      • 8. Re: Working With Related Data From A Closed File
                        listen2earth

                        OK thanks everyone!!  i had no problem to begin with.

                        i was thinking something was wrong, how i could be reading and writing data in my portal when its source / related file IS actually physical closed.

                         

                        Of course it makes sense .. when two files are related and if you start up the application opening just ONLY the file with the portal, then the portals source file is opened and stays hidden (unless the relationship gets broken somehow).

                         

                        Then the answer, from all what everybody says ..  "HIDDEN WINDOW"  means it is opened,  residing in Memory !!  And bottom line: you cannot ever open just one related file.  Of course !!!  And naturally my startup scripts will not fire until i call upon the window. Thats where i was getting getting confused. i was seeing my data in my portal BEFORE i clicked on my navigation button to go to its source file and when the source file came in view then my startup scripts got activated !!

                         

                        OK !!  Fine !!  its answered !!  i bury myself royal deep in other supreme complications of development and FORGET FM BASIC STRUCTURES !!

                         

                        However on this subject, questioning FileMakers Foundation . . 'what would be wrong with FileMaker having an option, of allowing a related file to stay physically closed"!!!???

                         

                        Some files could grow to be huge gigabytes and take up a lot of memory blocks. Then FileMaker could simply write the data directly onto the hard drive?

                         

                        r o b

                         

                        http://help.filemaker.com/app/answers/detail/a_id/9292/~/closed-files-appear-in-window-%3E-show-window-menu

                        • 9. Re: Working With Related Data From A Closed File
                          BruceHerbach

                          Rob,

                           

                          If you want to see the data in the portal, the file has to be open.  If you change the data,  FileMaker has to write the data back to the file.  Not doing so would be like spending an hour writting a chapter for a book,  then closing the window without saving the chapter. FileMaker doesn't want you to loose your data and if multiple people are using the database,  they will need to see the changes you make when you make them.   So in short if the file is closed... it isn't available if it's available the file is open.

                           

                          Bruce

                          • 10. Re: Working With Related Data From A Closed File
                            listen2earth

                            Yes agree!!  But let's speculate to say you had a file that was 77 gigabytes. Certainly there's no sense to OPEN this file to Read and Write if all you could do is access it through a portal if FM had a structured option for this.

                             

                            r o b

                            • 11. Re: Working With Related Data From A Closed File
                              Stephen Huston

                              Hi Rob,

                               

                              The size of the file isn't at issue here. FM caches the data which is required for whatever is loaded on-screen.

                               

                              That could include any or all of the portal file, depending on what relationships  must resolve.

                               

                              But then, the data for resolving the realtionships must be cached (read from the file) for the portal to work. When your file is properly hosted on FM Server, the server manages the caching of what is needed to the local machine. There are certainly improvements which could be made in how records are cached, but developers can also optimize caching by ofloading some fields from Wide Tables (those with lots of fields) to related tables so that fewer fields of data require caching.

                               

                              Stephen Huston