cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ashok2
Level: Powered On

Single Gallery from multiple sharepoint list

Currently my powerapp is having a gallery which is based on two SharePoint list below structure there is no relationship between list but Title of List A = Title of  List B 

 

ListA > Title ,First Name, Last Name       

             123 ,  Test ,         Test2                          

List B > Title , Country, Code

              123 , Test3  ,Test 4

 

I want to gallery items set as below 

Title, First Name, Last Name, County , Code

123   Test          , Test2,          Test3      Test4

 

But if i am trying below formula it giving me two items in gallery 

 

Title, First Name, Last Name, County , Code

123                                          Test3      Test4

123   Test          , Test2,          

 

ClearCollect(CombinedFilteredLists,
Filter(ListA, StartsWith(Title, TextInput1.Text)),
Filter(ListB, StartsWith(Title, TextInput1.Text)))

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Single Gallery from multiple sharepoint list

So this is how I did it: 

 

Instead of collecting the combined items in one list or collection, I created a gallery of List B items filtered on title being the same as the title stored in a variable. Then I also displayed the Title, First Name, and Last Name from the List A item that was stored in the variable. 

 

I created 2 collections for my testing: 

ClearCollect(ListA, {Title11: "123", FirstName: "FirstName1", LastName: "LastName1"});
ClearCollect(ListB, {Title21: "123", Country: "Country1", Code: "Code1"}, {Title21: "123", Country: "Country2", Code: "Code2"});

Then I set the Items property of my gallery to 

Filter(ListB, Title21 = LookUp(ListA, Title11 = TextInput9.Text).Title11)

I named the titles this way just to make it easy to differentiate between them. Also, TextInput9 is my text input control where the user can enter the title of an item from ListA. A variable can also be used, the way you want it to be. 

 

Since I already have the specific ListA record, I use that to display the properties of ListA that you want to show along with the details of each ListB item for which the title is the same as the ListA item. 

 

The result of all this is as shown below:

CombinedList.gif

 

So unless you need these results combined in a collection, this should meet your needs. If you do indeed need them in a combined collection, let me know. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!

Hardit Bhatia
https://www.thepoweraddict.com

View solution in original post

Super User
Super User

Re: Single Gallery from multiple sharepoint list

That's correct. Since ListA items are not within the Gallery source, you cannot access them by using ThisItem. 

 

A few things to help you: 

1. My Gallery Items property is set to: 

Filter(ListB, Title21 = LookUp(ListA, Title11 = TextInput9.Text).Title11)

2. I access ListA properties the following way (similar to Gallery's Items property:

LookUp(ListA, Title11 = TextInput9.Text).Title11 
LookUp(ListA, Title11 = TextInput9.Text).FirstName
LookUp(ListA, Title11 = TextInput9.Text).LastName

 

Let me know if this helps. 

 

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!
Hardit Bhatia
https://www.thepoweraddict.com

 

View solution in original post

9 REPLIES 9
Super User
Super User

Re: Single Gallery from multiple sharepoint list

Quick question before I get to the solution. I see you are using text entered in a text input control to get the Title. Is that what you expect your user experience to be or do you want to loop through the 2nd list for each item in the 1st list?
Also, is there a possibility that a Title may exist in only one of the 2 lists?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com
Ashok2
Level: Powered On

Re: Single Gallery from multiple sharepoint list

Yes correct Title will always be in List A , but it may or may not present in List B if its not there then no items need to be shown in gallery , in that case we give option to end user to add that is different screen ,

 

Title is text control its what i am trying for testing , in real case it will be a variable which is set in another screen  from where user navigate to this gallery . and as per variable value   it will loop through the 2nd list for each item in the 1st list.

Super User
Super User

Re: Single Gallery from multiple sharepoint list

So just to be sure, there could be a situation in which a user selects an item from list A on screen 1, then comes to screen 2, and the user will expect to see all entries from list B that have the same title as the item that the user selected from list A on screen 1.

Is this correct?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://www.thepoweraddict.com
Ashok2
Level: Powered On

Re: Single Gallery from multiple sharepoint list

yes correct
Super User
Super User

Re: Single Gallery from multiple sharepoint list

So this is how I did it: 

 

Instead of collecting the combined items in one list or collection, I created a gallery of List B items filtered on title being the same as the title stored in a variable. Then I also displayed the Title, First Name, and Last Name from the List A item that was stored in the variable. 

 

I created 2 collections for my testing: 

ClearCollect(ListA, {Title11: "123", FirstName: "FirstName1", LastName: "LastName1"});
ClearCollect(ListB, {Title21: "123", Country: "Country1", Code: "Code1"}, {Title21: "123", Country: "Country2", Code: "Code2"});

Then I set the Items property of my gallery to 

Filter(ListB, Title21 = LookUp(ListA, Title11 = TextInput9.Text).Title11)

I named the titles this way just to make it easy to differentiate between them. Also, TextInput9 is my text input control where the user can enter the title of an item from ListA. A variable can also be used, the way you want it to be. 

 

Since I already have the specific ListA record, I use that to display the properties of ListA that you want to show along with the details of each ListB item for which the title is the same as the ListA item. 

 

The result of all this is as shown below:

CombinedList.gif

 

So unless you need these results combined in a collection, this should meet your needs. If you do indeed need them in a combined collection, let me know. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!

Hardit Bhatia
https://www.thepoweraddict.com

View solution in original post

Ashok2
Level: Powered On

Re: Single Gallery from multiple sharepoint list

Thank you for this result is as i expected but when i am trying to inplement same in my solution  field from list A does not populate it only populate filed from  list  B , as if i do "Thisitem." list A value does not appear in gallery ,

Super User
Super User

Re: Single Gallery from multiple sharepoint list

That's correct. Since ListA items are not within the Gallery source, you cannot access them by using ThisItem. 

 

A few things to help you: 

1. My Gallery Items property is set to: 

Filter(ListB, Title21 = LookUp(ListA, Title11 = TextInput9.Text).Title11)

2. I access ListA properties the following way (similar to Gallery's Items property:

LookUp(ListA, Title11 = TextInput9.Text).Title11 
LookUp(ListA, Title11 = TextInput9.Text).FirstName
LookUp(ListA, Title11 = TextInput9.Text).LastName

 

Let me know if this helps. 

 

If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!
Hardit Bhatia
https://www.thepoweraddict.com

 

View solution in original post

Highlighted
Ashok2
Level: Powered On

Re: Single Gallery from multiple sharepoint list

It Worked Thank you 😊

Super User
Super User

Re: Single Gallery from multiple sharepoint list

Glad I could help! Good luck with the rest of your app! Feel free to reach out in case of any questions!

Thanks,
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,404)