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

Not able to display collection in gallery list box

Hello,

 

We have an collection inside an collection but that information is not displaying in the list box. 

 

As you can see the in the screenshot, its adding the contact in the collection but not displaying and updating the list box as we keep adding one by one.

 

Maybe there is another way to accomplish this.

Listbox Code: Item = LookUp(ShipTo,ShipToNumber=ThisItem.ShipToNumber).ShipToContact

 

ShiptoContact= SecondCollection inside the ShipToCollection

 

Collection.PNG

3 REPLIES 3
Highlighted
Anonymous
Not applicable

Re: Not able to display collection in gallery list box

Hi @Anonymous 

 

I tried to simulate the scenario based on the query raised:

 

OnVisible of my screen I load data as follows:

 

ClearCollect(emails, {email: "e1"}, {email:"e2"}); ClearCollect(collShipment, {shipid: 1, shiptoemail: emails})

onSelect of "Add Contact":

 

Collect(emails, {email: TextInput1.Text}); UpdateIf(collShipment, shipid= ThisItem.shipid, {shiptoemail: emails }) 

Items property fo ListBox is set to - shiptoemail

 

 

Thanks.

 

Highlighted
Community Support
Community Support

Re: Not able to display collection in gallery list box

Hi @Anonymous ,

Could you please share a bit more about your scenario?

Do you want to list your Collection (which includes a nested collection) within a Gallery?

Could you please share a bit more about the data structure of your collection?

Further, how do you add Contact into your inside second Collection? Could you please share me your formula?

 

Based on the needs that you mentioned, I afraid that there is no direct way to add values into the inside collection within a Collection within PowerApps currently.

 

As an alternative solution, I have made a test on my side, please take a try with the following workaround:2.JPG

 

3.JPG

 

4.JPG

 

5.JPG

Set the OnStart property of the App control to following:

ClearCollect(
             ShipTo, 
             {ShipToNumber: 4564, ShipToContact: Table({Value: ""})},
             {ShipToNumber: 4565, ShipToContact: Table({Value: ""})}
)

Add a Gallery, set the Items property to following:

ShipTo

Within the Gallery, add a "Add Contact" button, "Ship To Emails" Text box and a List box. Set the OnSelect property of the "Add Contact" button to following:

ClearCollect(CurrentContacts, RemoveIf(ThisItem.ShipToContact, Value=""));
Collect(CurrentContacts, TextInput2.Text); /* <-- Add new contact to existing ShipToContact field*/
Patch(ShipTo, ThisItem, {ShipToContact: CurrentContacts}) /* <-- Modify the ShipToContact field in your ShipTo collection*/

Set the Items property of the List box to following:

ThisItem.ShipToContact

Set the SelectMultiple property of the List Box to following:

false

Please check the following GIF screenshot for more details:Test.gif

 

In addition, if you want to remove the contact record from the ShipToContact field in your ShipTo collection, please take a try with the following workaround:

Add a "Remove" button within your Gallery, set the OnSelect property to following:

ClearCollect(CurrentContacts, RemoveIf(ThisItem.ShipToContact, Value = ListBox1.Selected.Value));
Patch(ShipTo, ThisItem, {ShipToContact: CurrentContacts})

Please take a try with above solution, check if the issue is solved.

 

More details about Patch function, please check the following article:

Patch function

 

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.
Highlighted
Anonymous
Not applicable

Re: Not able to display collection in gallery list box

Thank you support Team for great reply.

 

Problem:  One customer will have mulitple ship number. Each of these numbers will have mulitple contacts. 

 

We previously had an one collection with email contact as column but when adding an another shiip number, it carries over the contact list from list box to second ship number.

 

Thats why we created an Collection inside an collection to it can store each of the ship number and value for each contact in the second collection. Screenshot shows below that after adding one ship number, i can add another ship number underneath with contact information related to that ship number.

 

Powerapps.PNG

 

Collection:

- ShipTo (Main Collection)

     - ShipToContact (Second Collection inside ShipTo)

 

Ship To (Field):

- ShipToContact, ShiptoNumber

 

ShipToContact (Field):

- Contacts

ShipTo.PNGShipToContact.PNG

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,433)