4 Replies Latest reply on Nov 9, 2009 2:27 PM by senriz_1

    Automatically Eliminate Record Criteria in Script

    senriz_1

      Title

      Automatically Eliminate Record Criteria in Script

      Post

      I'm a novice using FMP 9.  I have a layout called Forms, of which I have duplicated as Locked Forms and set all the field behaviors to unmodifiable.  The main Forms layout has a checkbox to lock the form when completed.  I created a script that produces a list for a selected student and displays whether the form is locked or not.  I then created another script, attached it as a button on the list, that allows you to select the form you want and display it in the main Forms layout or the Locked Forms layout based on the Locked Checkbox.  This script does take me to the correct layout with the correct form... but the problem is if a student has an unlocked Form and a Lock Form they both will show up in the found set.  Hence, if I click to go to a Locked Form, on there I can click next record and the unlocked form shows up in the Locked Form layout and the same for unlocked Forms too, it will show a locked form.  I've tried using the Constrain Found Set in my script, but I get "No records found" error.  Below is my script.  I would appreciate any insight into how I can eliminate the unwanted records.  Thanks.   

       

      If [ ValueCount (IEP::LockCkBx) = 1 ]

      Go to Layout [ “Locked IEP Forms” (IEP) ]

      Enter Browse Mode

      Adjust Window

      [ Resize to Fit ]

      Else

      Go to Layout [ “IEP Forms” (IEP) ]

      Enter Browse Mode

      Adjust Window

      [ Resize to Fit ]

      End If

       

        • 1. Re: Automatically Eliminate Record Criteria in Script
          philmodjunk
            

          This sounds like an issue I had with a "PhoneMessages" widgit that I set up so employees could take down phone messages and route them to appropriate recipients. I gave them two message formats: "Message" and "Memo" where Message uses most of the screen layout for formatted check box fields and the like to quickly take down standard type messages and "mem" displays a single large text field over most of the layout.

           

          I use a script trigger, OnRecordLoad to perform a script that selects the appropriate layout for the new current record.

           

          To set a trigger for a layout, go to the Script Trigger tab in Layout setup...

          Be careful with all layout based triggers. Other scripts in your DB that interact with this layout will likely activate this trigger also--with possibly unexpected results.

           

          Though I don't see the reason for the Adjust window and enter Browse mode steps, Your script, as written, could be linked to this script trigger.

          • 2. Re: Automatically Eliminate Record Criteria in Script
            senriz_1
               Thanks.  I'll keep those instructions when I upgrade to FMP 10, do you have a solution of FMP 9 though???  Also, I used Adust Window because the Layout is very large and depending on what layout was used previously sometimes it shows much smaller than wanted.  I use Browse mode so they can navigate to the many tabs that are on the layout.
            • 3. Re: Automatically Eliminate Record Criteria in Script
              philmodjunk
                

              Pre FMP 10, I've used this approach.

               

              Hide and lock the task bar so that the "book" control for clicking through records is not available.

              Create your own button bar with tool bar functions across the top of your screen to put back any tool bar functions you want to make available. Since these are buttons you've created, you can attach scripts that also control what layout is displayed after they move to a different record, find records, etc.

               

              With FMP 9 advanced, you may have a better approach in that you can design custom menus where you replace each menu option that could switch you to a different record with a script that performs the same action then selects the script that selects the appropriate layout.

               

              As a final security measure, I'd use accounts and privileges settings to set things up so that if the user finds a way around all the above tricks, all they see is "<<access denied>>" if they get to the wrong layout for the current record.

               

              In response to Enter Browse Mode and Adjust Window:

              Since you have to be in browse mode to move from record to record, I assumed that you would be in browse mode every time you performed that script. It's harmless, but appears unecessary. I was checking in case there was something unsual going on there.

               

              Likewise, since both layouts can be displayed in the same window and switching from one layout to the other won't change the current window size, adjust window would seem unecesary.

              • 4. Re: Automatically Eliminate Record Criteria in Script
                senriz_1
                   Thank you.  This is a great solution!!