cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Collection rows to reflect SharePoint columns

Hello everyone,

 

I am having an issue with Collections and Galleries in PowerApps.

I have a Roles Matrix in SP which looks like this:

 - Column 1: GroupName (eg. Engineering, Marketing, Sales, etc)

 - Column 2: Manager (eg. Bob, Martha, Paul, Abby, etc)

 - Column 3: Assistant (eg. Mary, Nick, Joe, etc)

 - Column 4: Director (eg. Melody, Steve, Kurt, etc)

I have a drop down that selects a Group Name from the list. Based on that group name, I can get the people for each role corresponding to the group. No Problem.  However, I need a Gallery that  shows in each tile the column header (Manager, Assistant, Director) and the corresponding person. 

I am not able to automatically collect the list headers. I thought that a possible solution would be to get the information in a collection and go from there like this:

 

ClearCollect(RolesList, {Role:["Manager", "Assistant", "Director"}, {PersonName: [LookUp(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name).Manager, LookUp(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name).Assistant, LookUp(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name).Director]})

 

This solution gives me a table inside the Role collection column and another table inside the PersonName collection column.

 

Any advise would be greatly appreciated!

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Do you want to reference the column name as column header within your Gallery?

 

Based on the needs that you mentioned, I afraid that there is no simple solution could achieve your needs. As an alternative solution, you could consider add several Labels outside the Gallery to act as column headers as below:

8.JPG

then set the Items property of the Gallery to following:

Filter(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name)

within the Gallery, add same amount of Labels as the column headers (outside Gallery), set the Text property to following:

ThisItem.Manager
ThisItem.Assistant
ThisItem.Director

 ..

...

 

If these Manager field, Assistant field and Director field are all Person type columns in your SP List, please modify above formula as below:

ThisItem.Manager.DisplayName
ThisItem.Assistant.DisplayName
ThisItem.Director.DisplayName

...

...

Please consider take a try with above solution, check if it could help in your scenario.

Note: Currently, there is no simple way to reference column names from a data source within an app. We could only type the columns manually within an app.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi Again!

I kept tinkering with it and I found that the correct syntax for what I needed to achieve is:

 

ClearCollect(RolesList,

{Role:"Manager", PersonName: LookUp(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name).Manager},

{Role:"Assistant", PersonName: LookUp(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name).Assistant},

{Role:"Director", PersonName: LookUp(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name).Director})

 

In my actual application I have 20 different roles.  Is there a more efficient way to accomplish this?

Thanks!

Hi @Anonymous ,

Do you want to reference the column name as column header within your Gallery?

 

Based on the needs that you mentioned, I afraid that there is no simple solution could achieve your needs. As an alternative solution, you could consider add several Labels outside the Gallery to act as column headers as below:

8.JPG

then set the Items property of the Gallery to following:

Filter(RolesMatrix, GroupName = DD_GroupSelection.Selected.Name)

within the Gallery, add same amount of Labels as the column headers (outside Gallery), set the Text property to following:

ThisItem.Manager
ThisItem.Assistant
ThisItem.Director

 ..

...

 

If these Manager field, Assistant field and Director field are all Person type columns in your SP List, please modify above formula as below:

ThisItem.Manager.DisplayName
ThisItem.Assistant.DisplayName
ThisItem.Director.DisplayName

...

...

Please consider take a try with above solution, check if it could help in your scenario.

Note: Currently, there is no simple way to reference column names from a data source within an app. We could only type the columns manually within an app.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,071)