3 Replies Latest reply on Aug 17, 2011 9:33 AM by philmodjunk

    Using Filemaker IWP and need to know current logged in account

    TimHardesty

      Title

      Using Filemaker IWP and need to know current logged in account

      Post

      I have all my users in the security accounts. I would like to konw which company the currently logged in customer is a part of so that I can present to them a different layout based on which company they are a part of.

      I have table which has all of their usernames and Companies in it.

      I saw in another post it has something about using Get(AccountName) in a calculated field. 

      Thank you

        • 1. Re: Using Filemaker IWP and need to know current logged in account
          philmodjunk

          Get (AccountName) in a script can be used to identify what account was used to access the database. If you have a table of account names in your database, you can match the account names there to the value returned by get ( accountname ). A field in this table can store the preferred layout name or layout number for that account so that your script can find this record, then use the data in the layout field to select the appropriate layout.

          • 2. Re: Using Filemaker IWP and need to know current logged in account
            TimHardesty

            Thanks for you answer. Let me ask a few more questions by breaking down your answers.

            For "If you have a table of account names in your database, you can match the account names there to the value returned by get ( accountname )" It looks like I need to set up a relationship between two tables. Which two tables? Also, which fields do I relate? Does the field in one of the tables need to be a calculated field with value as "Get AccountName).

            If this is a script, how/when do a I activate the script to do this function?

            Thank You

            • 3. Re: Using Filemaker IWP and need to know current logged in account
              philmodjunk

              You need only one table and no relationships are needed.

              A script to select the layout would look like this:

              Go To layout [UserTable (UserTable)]
              Enter Find Mode[]//clear the pause check box
              Set Field [UserTable::AccountName ; Get ( AccountName ) ]
              Set Error Capture [on]
              Perform Find []
              If [ get ( FoundCount ) ]
                 Go To Layout [UserTable::Layout ]
                 #use layout name or layout number by calculation options depending on whether you enter the name or number of the layout into this layout field.
              Else
                  Go To layout [//Use a layout with text on it to display an error message as UserTable didn't have a record for this account name]
              End If

               

              You can use File Options to specify that this script (or one like it) be performed each time the file is opened.