6 Replies Latest reply on Apr 3, 2012 1:07 PM by ClaudiuNemes

    Logged in user go to specific layout

    ClaudiuNemes

      Title

      Logged in user go to specific layout

      Post

      Hi there,

       

      I have a problem regarding a condition assigned to a “back to start layout” script.

       

      In each layout of the DB I have a “Back to Start” button that goes to “Start” Layout.  In one particular case, when “OutsideGuest” (Security Account created) is logged in I want that the “Back to Start” button goes to “StartOutsideGuest” layout.

       

      I create, only for this script, a field called

      “User” [Calculation (calculation result is Text), Global, =Get(UserName)]

      Because “User” have no other use, I put it as a nonprintable object,  in the header of the “Start” and the “StartOutsideGuest” layouts only, for testing purposes.

       

      The “Back to Start” script is as follows:

      [ If ( students::User = “OutsideGuest” ]

      Go to Layout [“StartOutsideGuest”]

      Else

      Go to Layout [“Start”]

      End If

       

      So, in brief, all users have access to “Start” layout except the OutsideGuest who must be redirected to “StartOutsideGuest” layout.

       

      Main problem is that when I connect with “OutsideGuest” credentials , =Get(UserName) function gives me the Admin name (main account) instead of “OutsideGuest”. This happens also for all the accounts created. No matter with what account I login, in “User” will be displayed the Admin.

       

      Could anyone help me with this? Maybe I use the wrong functions?

       

      Many thanks for your time,

      Looking forward to hear news from you,

      Yours,

      Claudiu

        • 1. Re: Logged in user go to specific layout
          philmodjunk

          Use get ( AccountName ) instead of Get ( UserName )

          UserName is a name specified in FileMaker preferences and you can easily have multiple computer user accounts with the same user name (or the users are all using the same user account...)

          • 2. Re: Logged in user go to specific layout
            ClaudiuNemes

            Hi Phil,

            Many thanks for your kind reply and sorry about the delay.

            I already tested with both get AccountName and UserName. Result is the same. In one case it will show always the default Account (Admin) and in the other the related name (Claudiu) no matter that I'm connected (logged in) with another account name.

            I also try to refresh layout onLoad, relookup value in the field but the results are the same.

            Have a great day

            See you,

            Yours,

            Claudiu

            • 3. Re: Logged in user go to specific layout
              philmodjunk

              That doesn't make any sense to me. How are the users accessing your database? From a computer running FileMaker Pro or from a Web Browser?

              Under no circumstances that I can conceive will get (accountName) return anything but the account name of the user who was logged in at the time the function evaluated. So reporting that it returns "the related name", does not seem possible unless your script is doing more than just check the value returned by this function.

              Have you defined different accounts in Manage | Security?

              How are you attempting to use Get ( AccountName ) to identify who is logging on?

              • 4. Re: Logged in user go to specific layout
                ClaudiuNemes

                Hi Phil,

                I have one field (used only for redirect reasons and present just in Start (default) and StartOutsideGuest layout for testing reasons only)

                “LoggedInUser” [Calculation (calculation result is Text), Global, =Get(AccountName)]

                and I use the condition like this

                [ If ( students::LoggedInUser = “OutsideGuest” ]

                Go to Layout [“StartOutsideGuest”]

                Else

                Go to Layout [“Start”]

                End If

                OutsideGuest AccountName have customized Read-Only privileges.

                Yours,

                Claudiu

                • 5. Re: Logged in user go to specific layout
                  philmodjunk

                  Use this script:

                  If [ Get ( accountName )  = “OutsideGuest” ]
                     Go to Layout [“StartOutsideGuest”]
                  Else
                     Go to Layout [“Start”]
                  End If

                  Your original calculation field should display the correct value if, instead of global storage, you select "unstored" after clicking the storage options button.

                  • 6. Re: Logged in user go to specific layout
                    ClaudiuNemes

                    Hi Phil,

                    You're a genius. Many thanks, everything works just fine. I put "BackToStart" script even in File Options -> Open/Close -> When opening this file -> Perform script -> "BackToStart" and works just fine on login.

                    Many thanks for you kind support and for the time you have spend with me. Hope I could assist you somehow in the near future.

                    Have a great day,

                    Yours,

                    Claudiu