3 Replies Latest reply on Apr 11, 2016 2:47 PM by Extensitech

    Defining user profile

    GuyRajotte

      I need some guidance on the best approach to define a user profile.

       

      I have a table called "User Profile" in which I store information per user such as: name address, email, birthdate, blood type, etc. This table contains one record per User. I need the user information to perform certain validation.

       

      How do I link this table to the active Login account? and how do I use the selected profile in any layouts or tables ou scripts?

       

      Thank you

       

      Guy

        • 1. Re: Defining user profile
          erolst

          GuyRajotte wrote:

          I need the user information to perform certain validation.

          Have you looked into the validation options that the field options dialog offers?

           

          GuyRajotte wrote:

          How do I link this table to the active Login account?

           

          One idea would be to base the login layout on the User table, perform a find for all active personnel and present them at a list; or create a Cartesian relationship ( x ) and display the users in a portal that you filter by active status.

           

          GuyRajotte wrote:

          and how do I use the selected profile in any […] scripts?

           

          The data from the selected profile will come either from the active record, or from a related record; in either case you can reference the relevant fields in a script. (When using a portal you may need to store them intermediately in variables, if e.g. the user first selects her name, then is prompted for pw entry.)

           

          GuyRajotte wrote:

          and how do I use the selected profile in any layouts or tables […]?

           

          That really depends on what your envisioned login process entails.

           

          If e.g. you have a log table, then you would record a successful login (or maybe even – or especially – unsuccessful attempts) by storing the user's ID (primary key) and use it to create a new log entry (record) where id_user would be a foreign key.

           

          Or store the userID in a global $$variable so it is readily available during that user's session to flag any records that user created or modified.

           

          Since FM is a relational database, once you've entered that userID, you can create relationships between these tables and the user table – which works in both ways: you can display the user name on any log entry, and by the same token see a list of any user's activity during any given day or period of time (logged in at xxx, created x, modified y, logged out at xxx …) from a User table context (layout).

          • 2. Re: Defining user profile
            GuyRajotte

            Hello, thank you very much for your helpful response.

            I have designed a fairly complex BD on nutrition and diets (+ others) with over 109 tables and some complex relationships. It is working very well and FMP does very nice things.

            I am now at the point where I am defining accounts in security. I am going to define different groups of users with specific privileges . I would like, for each user, to create and maintain it own user profile just like in FMP Community site.

            I have a table called "Profile" with all the information pertaining to each user. I would like to link that table to the current active user using one of the logon field such as Get ( UserName) or Get (AccountName) or Get (AccountPrivilege). I might not be using the right spelling because I have a French application.

            So in order to test this link with the active sign on user, I added these 3 fields into a table, and display it in a layout. Even if I quick the application and reopen it with a different user it always show my personal information for UserName, AccountName and AccountPrivilege.

             

            Am my looking into the right direction. Do you see any other way to link the User Profile table to an active user field for another table?.

            • 3. Re: Defining user profile
              Extensitech

              Even if I quick the application and reopen it with a different user it always show my personal information for UserName, AccountName and AccountPrivilege.

               

              It sounds as though you haven't made your calculated fields unstored, so they are not updating when another user logs in.

               

              HTH

              Chris Cain

              Extensitech