6 Replies Latest reply on Sep 10, 2009 1:02 PM by Travisbrack

    Conditional statement - User info

    Travisbrack

      Title

      Conditional statement - User info

      Post

      Hi there

       

      I'm trying to create an if statement that uses special information about the user to determine whether the conditions are true or false.  This information is stored in a different file.  This file does have the username of the user which I could match up with Get(AccountName) if such a thing were possible.

       

      Would it be possible to use Get(AccountName) to pull information from another FileMaker file about the current user?

       

      Thanks

      Travis

        • 1. Re: Conditional statement - User info
          philmodjunk
            

          Get ( Accountname) will return the account name used to open the current file. In many cases, both files will be opened with the same account name and in those cases, this will return what you want.

           

          If the other file was opened with a different account name, then you'll have to capture that account name in a field somewhere. The other file, for example could have a script that stores the result of get ( accountname ) in a field. Use file options to set this script to run when the 2nd file opens, and you'll succeed in capturing that data.

          • 2. Re: Conditional statement - User info
            Travisbrack
              

            Thanks for the reply

             

            I don't think I was clear on what I'm trying to accomplish...

            Example:

             

             

            (File1) in a script, display an error message if user's favorite food is pizza

             

            (File2)One record for each user.  Username field which matches Get(AccountName) and a field with the user's favorite food

             

            I want the script in File1 to figure out the user's favorite food by matching Get(accountName) with the username field in File2 to figure out what that is.

            Possible?

            • 3. Re: Conditional statement - User info
              philmodjunk
                

              Account Name and User Name are two different things.

               

              Account Name is set in Accounts and Privleges and may be different for each file.

               

              User name is a preference setting for the filemaker app.

               

              Get ( AccountName ) will return the name of the account name used to open the current file.

               

              Get ( UserName ) will return the User Name from preferences and this will give you the same result for every file a given user opens on their computer.

              • 4. Re: Conditional statement - User info
                Travisbrack
                   Right. I want to use Get(AccountName) since that will always be the active directory username.
                • 5. Re: Conditional statement - User info
                  comment_1
                    

                  Define an unstored calculation field (result is Text) in File1 =

                   

                  Get(AccountName)

                   

                  and set up a relationship matching the calculation field to the AccountName field in File2.

                   

                   

                  Then you can refer to the related data in a calculation, e.g. =

                   

                  Case ( File2:: FavoriteFood = "pizza" ; "error message" )

                  • 6. Re: Conditional statement - User info
                    Travisbrack
                       Yes!!  Thank you!