2 Replies Latest reply on Apr 26, 2012 11:06 AM by FM_Rookie

    "Go To Layout" NOT working properly

    FM_Rookie

      Title

      "Go To Layout" NOT working properly

      Post

      I believe this is a bug in FM, b/c it happens to me often.  But I have now experienced it in the FM Training Series, lesson example 6.4.1.

      It has you created a script that opens a new window. Here is the script (taken directly from the above lesson):

      Allow user Abort [Off]
      Set Variable [$group; Value:GROUP::__kp_Group]
      New Window [Name: "Select Person"; Height: 500; Width: 250; Top 50; Left: 200]
      Go to Layout [“Person_Picker” (PERSON)]
      Show/Hide Status Area [Lock; Hide]
      Show All Records Sort Records [Restore; No dialog]
      Go to Record/Request/Page [First]
      Set Variable [$result; Value: Get (ScriptResult)] If [$result > 0 and $result ≠ “Cancel”]
      Go to Layout [“dev_PersonGroup” [PERSONGROUP)]
          New Record/Request
          Set Field [PERSONGROUP::_kf_Person; $result]
          Set Field [PERSONGROUP::_kf_Group; $groupID]
      End If
      Close Window [Name: “Select Person”; Current file]

      I am using FMProAdv11, so I can run the debugger.  When it runs the script it goes to "Go to Layout [“Person_Picker” (PERSON)] " fine with the proper (and wanted) view as form, but in the very next step (Show/Hide) it jumps to "Table" view (even when "Table View" is  disabled in the Layout Setup). 

      I did look at the "dev_PersonGroup” layout at one point & changed views.  But I can't believe this would change something so fundemental.  Even if I go back to the layout & make sure I switch to Form View before closing the Layout, it STILL does this goofy thing.  And I didn't go into Layout Mode, I just changed the View. When I open the above Layout from "Manage Layouts" it goes to Form view, because the default view is set to Form View.  This seems to only happens when running from a script. 

      This has happened in MANY situation in OTHER FMDBs I've worked on.  What is the problem?

      Thanks!

        • 1. Re: "Go To Layout" NOT working properly
          philmodjunk

          Hard to say. Using Go to layout is an extremely common script step. I've used it in many versions many, many times and it has never, ever changed the layout's view from its current setting. Nor have I seen any reports matching what you describe here or over in the "Report an Issue" section that is intended for posting possible bug reports.

          When you ran this script, was it a single user file on your machine or hosted from a server? (I'd expect that you have it as single user, but there's a possible explanation if it's hosted from another computer.)

          When you stepped through the above script, can you confirm that no script triggers fired and started up a different script? (You'd see if pop up in the debugger.)

          Another longshot: Do you have an OnLayoutExit trigger specified for the "Person_Picker" layout?

          Finally: What version of FileMaker are you using and on what version of what operating system?

          • 2. Re: "Go To Layout" NOT working properly
            FM_Rookie

            Thanks for the reply PMJ. 

            It is a local file.  I am using FMProAdv11.  There are no other scripts running or called.  This happens to me on Win (WinXP) & Mac platforms (OSX Snow Leopard) & different installations (at work-Win, at home-Mac).  It's so frustrating!  I was afraid I'd get something like this.

            I have just figured a bit of it out.  If I go to the Layout and switch to a view, then CLOSE FileMaker & re-open it the file, it will then use the last View I looked at as the view for a script.  Seems a bit buggy for that to even over-ride the default view setting.  Things work now.