5 Replies Latest reply on Jan 25, 2016 10:36 AM by mcemond

    Filter on startup not working...

    mcemond

      Hi

      I use a startup script to direct different privilege sets to the proper landing pages. The accounts under the "worker" privilege set are directed to the "Assignments" layout. The assignments layout has an OnLayoutEnter script trigger to a second script that filters the assignment records by status: Open and account name. So the user only sees their own open assignments. If I use a button to navigate to the assignments layout, the filter works fine. If I use the startup script, the workers see their own assignments but they see both open as well as finished assignments. My question is how can I get both filter criteria working when the app first opens using the startup script?  This effect is seen on both FMPro Advanced 13 as well as FM Go Latest version and file is hosted on a FM Server.

      Thanks

      Mike

       

      The start up script (which works at identifying the correct landing page):

      Set Variable [$PrivilegeSetVariable; Value:Get ( AccountPrivilegeSetName )]

      Set Zoom Level [Lock; 100%]

      If [$PrivilegeSetVariable = "worker"]

           Go to Layout ["AssignmentsLayout" (logTime)]

      End If ... script simply goes on to identify other sets and direct them to their respective pages.

       

      The onLayoutEnter script for the Assignments page:

      Set Zoom Level [Lock; 100%]

      Set Variable [$AccountNameVariable; Value:Get (AccountName)]

      Enter Find Mode []

      Set Field [workOrder::status; "Open"]

      Set Field [crewAssignments::accountName; $AccountNameVariable]

      Set Error Capture [On]

      Perform Find []

      Constrain Found Set []

      Set Error Capture [Off]

      Sort Records [Restore; No dialog]

      Scroll Window [Home]

        • 1. Re: Filter on startup not working...
          emory_brown

          Why are you doing a perform find AND a constrain found set?

           

          There are a lot of things that could be at play here. Have you debugged the script to see exactly where it is showing all records? Make sure you have script triggers turned on in the debugger.

          • 2. Re: Filter on startup not working...
            wimdecorte

            do you get any errors when you step through the opening sequence with script debugger?

            • 3. Re: Filter on startup not working...
              mcemond

              Thanks for your reply. I have confirmed script triggers are turned on in debugger. Ran with debugger open and no errors were reported in startup or page load. I removed constrain found set, so that cleaned up the script a little but didn't solve the issue. Its weird that it works in one case and not the other. So I guess what is different between loading a page from a startup script and loading a page from an in-app navigation button? The table relationships should work in both right? 

              • 4. Re: Filter on startup not working...
                emory_brown

                There is no difference between the opening script triggers and scripts triggered from the UI.

                 

                Did you successfully debug through the triggered OnRecordLoad? To do this, make sure you "step into" the Go To Layout step in the open script.

                • 5. Re: Filter on startup not working...
                  mcemond

                  Thanks. I stepped through all the scripts and still no errors. However, you did send me on a different line of trouble shooting and I changed my default home page to the one I was having difficulty with so I guess staying on the same layout through the steps made something work. I still think this is a little odd. Thanks for working through it with me though.

                  Mike