cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
situ
Regular Visitor

How to filter a field with datatype table in Collection? (Using Sharepoint as database)

Hi at all, 

 

I have the following goal to reach: 
1. Save data from a SharePointList with datatype Person/Role in a Collection 🆗
2. Save the Displayname of the currentUser in a variable 🆗
3. Filter the collection with the current username (Filter datatype table) 😭

4. show the username/ list of names in a dropdownfield

The SharePointList looks like this: 

ID          | MitarbeiterSharePoointAccount| Koordinator1SharePointAccount| Koordinator2SharePointAccount
Number| Person or Group                         |  Person or Group                        | Person or Group

situ_0-1651824678737.png


Case 1: The current user is a normal Employee
The Employee should only see his own data
Filter: _currentUser = Mitarbeiter SharePoint Account


Case 2: The current user is one of two Supervisor
The Supervisor can see his own data and the data of his Employees. 1 Employee can have up to two Suvervisor

I have tried the following: 
App OnStart
/*User*/
Set(_currentUser; User().FullName);;

ClearCollect(colMitarbeiterBR;ShowColumns(Mitarbeiter;"ID";"KoordinatorAccount";"Koordinator_2_SharePoint_Account";"MitarbeiterAccount"));;

situ_1-1651825331839.png

As you can see the SharePointAccount-Fields have the datatype table. 

If I try to filter those fields I get no results. I checked if the current user has an entry in SharePoint. I also checked the name. They should match. 

ClearCollect(colMitarbeiterB;Filter(Mitarbeiter;('Koordinator SharePoint Account'.DisplayName = _currentUser) Or ('Koordinator 2 SharePoint Account'.DisplayName = _currentUser) ));;

Has anyone an idea how to deal this problem? 


 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @situ ,

 

 

Do you want to filter the data based on the DisplayName field in the Person column?

I have made a test for your reference.

 

1. Here is my SharePoint list.

vyujincuimsft_0-1652089000836.png

2. Select the App and apply the following formula on its OnStart property as:

Set(_currentUser, User().FullName);
ClearCollect(colMitarbeiterBR,ShowColumns(BasicInfo,"ID","user","sales"));

3. Select the Gallery and apply the following formula on its Items property as:

Filter(colMitarbeiterBR,_currentUser=user.DisplayName)

Result Screenshot:

vyujincuimsft_1-1652089220426.png

 

 

Best  Regards,
Charlie Choi

 

 

View solution in original post

1 REPLY 1
v-yujincui-msft
Community Support
Community Support

Hi @situ ,

 

 

Do you want to filter the data based on the DisplayName field in the Person column?

I have made a test for your reference.

 

1. Here is my SharePoint list.

vyujincuimsft_0-1652089000836.png

2. Select the App and apply the following formula on its OnStart property as:

Set(_currentUser, User().FullName);
ClearCollect(colMitarbeiterBR,ShowColumns(BasicInfo,"ID","user","sales"));

3. Select the Gallery and apply the following formula on its Items property as:

Filter(colMitarbeiterBR,_currentUser=user.DisplayName)

Result Screenshot:

vyujincuimsft_1-1652089220426.png

 

 

Best  Regards,
Charlie Choi

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (4,677)