User Permissions to filter datatable

Custom Code

Afternoon all.

Trying to Filter a datatable but need to go through some finer steps first. The primary idea is to filter the datatable of the users (set by their location) and filtering against the current user / authenticated users permissions as to what locations they are allowed to see.

Collections and fields are listed as below for the important information.

Collection "Users"
Field - uid
Field - CompanyName
Field - CompanyLocation
Field - display_name

Collection "UserPermissions"
Field - uid
Field - LocationFilter

Collection "CompanyLocations"
Field - CompanyName
Field - CompanyLocation

The idea is to check the authenticated user / current user permissions for "LocationFilter" using the authenticated users "Users ID" = "uid" of the collection "UserPermissions"

If the "LocationFilter" = "All Locations"
Filter the results that show on the datatable with
Authenticated user "CompanyName" = Users "CompanyName"

If the "LocationFilter" = "Only location they are based from"
Filter the results that show on the datatable with
Authenticated user "CompanyName" = Users "CompanyName"
Authenticated user "CompanyLocation" = Users "CompanyLocation"

Once these filters are set, the table will populate its fields accordingly.

I am happy to have assistance in many forms
- YouTube videos to explain everything relevant that is easy for me to understand.
- Websites with explanations
- Hints and tips of what to research
- If someone was so kind to write me step by step of what i need to do, that would also be great. ๐Ÿ˜„

Hopefully once resolved, i will have a better understanding of how this works. As there will be multiple occassions within my app that this kind of filtering will be required with different things other than location and users.

What have you tried so far?

I am having absolutely no issues at all populating the datatable with information, The issue i am having is telling it when to show all users from 1 location only (the one the authorized user belongs to) or showing all users within the company. I understand this is probably 2 separate query, however i do not know how to implement 2 at the same time.

Ive attempted to create a conditional query in the Container for the datatable in the Action Flow Editor. This does not work.

I am trying to make a conditional filter in the Query collection directly on the Backend Query page. This also is not working for me.

Im currently trying to find a youtube video that could assist with this situation.

Did you check FlutterFlow's Documentation for this topic?
Yes
1
1 reply