4 Replies Latest reply on Sep 4, 2015 2:59 PM by PSI

    Filter View by User Account

    talkersw

      I'm not very familiar with Get (AccountName), but i believe this situation would apply. I have a request table and once the user submits the request, the information is shown in a task layout for the other user. The records are just reflected from the request table and the user completing the request can just view them. The driving field here is Owner. The Owner (name) for that record needs to be tied to the account so that the user will only see those records for which they are assigned.


      I need some condition that says if the Owner name field = Account Name for that user, filter for that user. Since this Owner field is a simply a lookup from another table, I am not sure how to apply a calculation.

        • 1. Re: Filter View by User Account
          mikebeargie

          I don't think you really need a calculation, you just need a found set on your layout for table::owner = get(accountname). I'd recommend doing an OnLayoutLoad script trigger that does a find for that.

          Enter Find Mode

          Set Field [ table::owner ; get(accountname) ]

          perform find

          sort records

          go to record/request/page [ first ]

           

          That simple script will find the right records for that user, sort them (EG by date of request), then go to the top of the screen.

          • 2. Re: Filter View by User Account
            talkersw

            Thank you very much. I see as walking through debugger that the Owner field is set to the AccountName.

             

            The Owner field is a text field for the name of the user. In a related table, their corresponding email is listed.

            The email is actually what is used for the AccountName, so the find is not registering. It populates the Owner field with the email for the signed in user. I want it to list the name of the User, and make the connection that this email account belongs to the owner name. 

             

            Do I need to pull the email field into my tasks screen in order for the find to work correctly?

            • 3. Re: Filter View by User Account
              talkersw

              Sorry, that was confusing.

               

              So I want the find to be based on the Name of the user logged in, not their Username.

               

              Let's say I am signed in as John Smith. How can I tell Filemaker that user account abc@gmail.com belongs to John Smith? When John runs the script, the find is for his name (not email), and reveals his tasks.

              • 4. Re: Filter View by User Account
                PSI

                You said there was a related table where you have the email stored? if so add a field for the 'Signed' in name. When the user logs in capture the Signed In Name in to a global variable $$SIN, ( just don't use 666  )

                 

                Use the $$SIN in the Find script or put it into a global field if you are filtering a portal.

                 

                John