Filter $[SYS_USER]

Hello all,

I created the Group table to assign my contacts to groups, to be used in setting permissions later. However, I want a way to check to what Group the logged-in user or $[SYS_USER] belongs to so that I can use the Visibility option to show each group different content.

Meez_image

Thanks is advance,
Meez :slight_smile:

Moderator note: Edited personal information.

Hi @Meezcal,

You can use FILTER() functions in conjunction with the $[SYS_USER]

Assuming your Name column is formatted as contacts, you can create local variables that can store the info so you can use it throughout your screen. For example, let's check if the users is a manager:

Create a datacell with the following filter and set it to be a variable.

=Filter(Users, "Users[Name]=$[SYS_USER] AND Users[Group]=""Manager""")>0

You can then use this variable in the Visibility section of other elements.

Please let me know if you have any questions.

Happy Honeycoding!

Hello Kamran,

Thank you for your reply, however I need is to filter the tasks of this subset of contacts and not the contacts themselves. For example I want to show the tasks that are assigned to the same designation of the $[SYS_USER]. So if the $[SYS_USER] is a manager he will get all managers' tasks.

Again, I appreciate your help.

Meezcal

Hi @Meezcal,

Based on my understanding of the app use case, I recommend the following but there could be other ways:

You will need to include the group information in the tasks table as well. So instead of using the contact format in the Tasks table, use picklist and set the source to the group memebership table. Once you have set that up, you can retrieve the group information of each user dynamically as follows:

Groups table:

Name Group Tasks

Tasks Table:

Tasks Assignee Group
Task1 User1 (rowlink from groups table) =[Assignee][Group]

Now, in the app you can do the following

Create a variable Group and set the value to:
=Findrow(Users, "Users[Name]=$[SYS_USER])[Group]

and then set the list source to:

=Filter(Tasks, "Tasks[Group]=$[Group]")

You can skip creating the variable but it helps with readability.

Please let me know if this helps.

Thanks! I tried before including the Group column in the Tasks table but I missed the syntax [Assignee][group]. :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.