1 2 Previous Next 18 Replies Latest reply on Jan 15, 2015 2:54 PM by wimdecorte

    Sep Data with Local UI.  Losing connection question

    Steve Wright

      Hi All,


      I am toying with a local UI file connected to a served data file but have come up with an issue and wondered if anybody has an idea.


      Lets say I host the data file via PC 1.

      I then open up the UI file on PC 2 which opens the shared data file from PC 1.

      So far so good.


      Now to simulate a network issue, I temporarily disconnect PC 1 from the network and wait for PC 2 to announce the lost connection and close affected windows.

      Next, I reconnect PC 1 to the network, so effectively the data file is available again.

      Here we have a problem.


      1. The UI window is not closed, because its apparently not affected by a missing data file, even though its trying to show related data via a portal and also a related field directly on the layout.

      2. The UI window now shows <File Missing> (as expected)


      Whilst wondering how I could trap this and invoke a script perhaps to re-connect, I decided to try a script which and figure out how to trap it later.


      I tried this script without luck, although it makes no sense why it fails in my opinion:


      Goto Layout (UI layout with no references to the data file whatsoever)

      Close File ["data"] - No errors, but it has nothing to do, file is already closed.

      Flush cache to Disk (added this as an afterthought, no effect)

      Open File ["data"] - No errors, but it does not open the file.


      I also note that Close File["data"] appears to do absolutely nothing, even from a UI layout with no data references when the hosted file is still available.



      Is there something I am missing? Is the only way to close the UI file and re-open it thus restoring the connection?
      Im pretty sure FileMaker Go can reconnect to data sources, so surely the fully blown desktop versions can?


      P.S. As to why I am looking at hosting a local UI file, well my thinking was to reduce overhead, although Im in no real position to test performance differences at this time, it may not be worth it in the end.

      Im basing my theory on the fact that 1 layout Im testing with is approximately 3.5mb in size (copied to myFMButlers ClipManager) compared to the same layout in 11 weighing in at only 400kb.
      My entire UI of the existing solution grows from around 40mb to about 140mb with absolutely no data whatsoever, surely this has to factor into performance (esp over wan) of course, I may be wrong.






        • 1. Re: Sep Data with Local UI.  Losing connection question
          Stephen Huston

          Why not host the data file on FMServer so it is always available to the UI file?

          • 2. Re: Sep Data with Local UI.  Losing connection question
            Steve Wright

            Hi Stephen,


            I have not tried it hosted via server, but I would presume the same outcome, since I am purposefully "simulating" temporary loss of network. 
            i.e turning off the LAN or Wifi adapter for a brief period then back on.


            No matter how I try to re-open the data file it wont open, unless I go to File > Open Remote.

            However even opening it this way, it is no longer reflected as the UI's data source until I close and re-open the UI completely.


            I would have thought re-opening the file would restore the link between UI and Data but as it stands it just leaves the UI in limbo regardless..
            It seems that the data source 'links' are only ever set on initial startup.  Im not sure how to refer to it, but hopefully you get my point.


            Its more of an experiment than anything.. 


            Edit: Failing a reconnection method, how could I get the UI file to be affected by the loss of the data file so FM closes ALL windows, I would have thought it should be by default since its showing data from the data file, but it doesn't.

            • 3. Re: Sep Data with Local UI.  Losing connection question
              Stephen Huston

              OK, you want to test what happens IF the data connection is lost -- I get that now.


              What happens if you create a script to "Reconnect..." which does a relogin script step. Maybe refreshing the creditials would attempt to do the same for the lost data file, without having to actually shut down the UI file.

              • 4. Re: Sep Data with Local UI.  Losing connection question
                Stephen Huston

                You could run a looping or onTimer script which tests for something in the data file and closes the UI file if it cannot find it. This would need to be really tight -- so you don't get a false m\"missing data" reading as long as the Data file is readable by the UI.


                Or how about an onTimer script in the UI file which tries to set some global field in the Data file and uses error capture determine if the global field is unavailable, exting the UI if the global in Data cannot be set by the UI.

                • 5. Re: Sep Data with Local UI.  Losing connection question
                  Steve Wright

                  That sounded like a great idea, it doesnt appear to work though, well.. something is working..


                  Although I cannot get the layout to refresh whatsoever, ie to show data again, I just noticed that I can go into Manage Databases and see the tables / fields on the relationship graph.. 


                  I can even go into Layout Mode and select fields from the data table so the file is actually re-opening, just not working via 'browse mode' after this occurence.

                  The FM toolbar even shows record 1 of 50 for example, but the layout still shows <file missing>  weird


                  If its open, I would have thought a close file > open file would do the trick, perhaps there is a bug with close file since I noted it appears to do absolutely nothing with this sort of setup.

                  • 6. Re: Sep Data with Local UI.  Losing connection question
                    Steve Wright

                    Thats something I have considered too... or to not bother with this arrangement and host the UI and data, which I have been doing for years.

                    I just convinced myself that there are performance gains to be had without any real evidence of such so thought I would experiment.


                    I appreciate the ideas and thoughts so far

                    • 7. Re: Sep Data with Local UI.  Losing connection question
                      Stephen Huston

                      Once the connection is reestablished, might a find/search, or a Show All records command refresh the data?

                      • 8. Re: Sep Data with Local UI.  Losing connection question

                        I think you are trying to get too tricky.

                        I think (untested) that you should have your UI script go to a layout with no data connections or perhaps a different relationship to the data file (perhaps with a flush joins) then back to the one which accesses the data file.


                        It just seems to me that by trying to close the data file that you are working against what it is trying to do naturally.


                        - Lyndsay

                        • 9. Re: Sep Data with Local UI.  Losing connection question
                          Steve Wright

                          Looking at it from the other perspective for a moment..


                          If you are connected to a hosted UI and data file and the network fails, FileMaker closes all affected windows, i.e the entire solution on the client.


                          With a local ui however, why is the local UI not affected and therefore not closed.  Considering that the layout is based on a TOC from the hosted data file and also displaying fields from these TOC's? 


                          Surely "All affected windows" should include the UI window because of its data source? 
                          This is what I was hoping to achieve anyway so a forced shutdown would behave more gracefully than it currently is.

                          • 10. Re: Sep Data with Local UI.  Losing connection question

                            ... there is always a timeout delay between losing the network and the message about closing windows. I accidentally change locations with connections open for sometimes minutes and when I switch back I can select the FM window and keep going.


                            Also you wouldn't want a local file to close just because it lost a connection to a remote file.


                            I have a file that has one-way relationships to another. The second file is opened hidden. If I click go to related record... the open script in the second file kicks in and the user is challenged for Authentication. When hidden without authenticating when I close the main file the other closes automatically because it opened it. That kind of hiding is different than if you say "hide window" via the menus.


                            My feeling therefore is what you need to do is refresh the relationship. If you have a global text field that gets populated with an open script or artifically add one to the table-relationship... then all you would need is to re-set that field's value and the whole thing should reconnect on its own.


                            - Lyndsay

                            • 11. Re: Sep Data with Local UI.  Losing connection question
                              Steve Wright

                              Hi Lyndsay,


                              Thanks for your input, Ill give that a go tomorrow,  its getting a bit late for me now (GMT) and its nothing to lose sleep over so I think I will hit the hay.

                              • 12. Re: Sep Data with Local UI.  Losing connection question
                                Steve Wright

                                I dont think a re-connect is possible in this way, but a shut down is certainly trappable in some convuluted form.


                                Running the same scenario on iOS, its clear FMI payed attention to this detail since on GO when access to the data file is lost you are asked if you would like to try and re-connect.

                                Clicking reconnect obviously works as expected if the network is up, If the network is still down it states it could not connect and allows you to retry again.

                                I wish it was that simple for the desktop.


                                I have tried quite a few things to no avail, so Im going to take it as not being possible to restore connection on the desktop one in this situation.

                                Below is a bit over the top admittedly, but all in the name of experimentation and it still doesn't restore connection.


                                Go to Layout[ UILayout ]

                                Flush Cache to Disk

                                Refresh Window [Flush cached join results]

                                Flush Cache to disk (again for the sake of it)

                                Close File [Data]

                                Re-Login [Account Name: "user"]

                                Open File [data]

                                Refresh Window [Flush cached join results]

                                Set field [data:globalfield; random]

                                Go to layout [based on TOC linked to data file]

                                Set field [datafile:globalfield; random]  (I placed this glob on the layout too)

                                Show All records

                                Show Omitted Only

                                Show All records

                                Refresh Window [Flush cached join results]


                                As you both suggested,  I can determine if setting the global field fails and close down, but that would take too much management with

                                I think FMI should implement the same technique they have with GO, which does exactly what I was looking to do, but just works and works well.



                                @ Lyndsay

                                I am unable to close a remote file referenced by the UI period.

                                I open the local UI and connect to the data file (open hidden),

                                Then return to the UI only layout with absolutely nothing related to the data file on it (its blank) and based on a table in the UI.

                                I then close the host.  The host prompts me to "ask the clients to close" so I click Ask.

                                The client then pop's up with a message to close the data file, but it cannot close it even from this layout.

                                The only way is to close the local UI which then automatically closes the hidden data file.

                                Even the countdown timer cannot automatically close the data file.


                                Just for reference, I can open the UI file landing on the same UI layout as above without opening the data file.

                                If I never look at the data, then closing the host does not prompt and it closes as expected.

                                The second the data is referenced (via another layout), even if I return the the same UI layout, the data file can no longer be closed.


                                This doesn't seem correct in my opinion, close file from that point should be able to close the data file and so should the request from the host.
                                This time since the connection to the host still exists, attempting to close the file gives error:




                                File or object is in use



                                Edit:  Please do not waste any time on this, I have decided to either use the "setting global" method to close the UI, or just host both ui and data.

                                I also failed to set this as a question, so cannot mark any helpful answers sorry about that.

                                • 13. Re: Sep Data with Local UI.  Losing connection question

                                  I am facing a similar situation: Two files operating locally each referencing a remote file served by FMS. As you described, I cannot find a way to assure that the local files will reconnect to the remote file when the connection is lost. Did you ever find a manageable solution?

                                  • 14. Re: Sep Data with Local UI.  Losing connection question
                                    Paul Jansen

                                    From reading this thread it seems that you cannot contrive a reconnect and that the only solution is to close the UI file and reopen it.


                                    Assuming you can establish that the connection to the data file is lost (in an onTimer script or in a subscript to navigation scripting) I would suggest the following


                                    Create a second db file with one script triggered when it opens which does the following.


                                    Close the UI file

                                    Open the Ui file

                                    Close itself


                                    You can then stick this in a container and when the broken connection occurs 'export field contents' to the same folder as the UI file with the Open file box checked.


                                    Obviously native functionality would be better, but in the absence of that....





                                    1 2 Previous Next