cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ZachRoberts
Resolver I
Resolver I

Iterate through collection to add a column to the collection

Hi All,

 

I have been struggling to get this to work and hoping I could get some help with the issue I am running into 😊

 

I have 2 tables below:

 

Table A

OrderIDTestID
001T01
001T02
002T01
002T03

 

Table B

TestIDDescription
T01T01 Desc
T02T02 Desc
T03T03 Desc

 

I have a gallery where a user will select the Order ID and when selected I am trying to create a collection like below which will store all of the tests and their descriptions for the selected order:

 

tests collection (for selected order)

TestIDTest Description
T01T01 Desc
T02T02 Desc

 

I run the below function to create this collection however I am stuck on how to add a column for the descriptions

 

 

ClearCollect(tests, Filter(TableA, OrderGallery.Selected.'order' in 'order').TestID)

 

 

I have looked into the ForAll and AddColumns function but I am unsure how I would iterate the function to add the description column to my collection so that the test in the collection also contains the description for it.

 

Thank you for your help

1 ACCEPTED SOLUTION

Accepted Solutions
ZachRoberts
Resolver I
Resolver I

Hey I was able to solve this issue. 

 

I did some more googling and came across this post here: Solved: Re: Creating collection from multiple tables - Power Platform Community (microsoft.com)

 

I followed the approach to create a separate collection where you would join the other 2 data sources in. Thanks everyone for your help 😊

View solution in original post

4 REPLIES 4
rubin_boer
Super User
Super User

hi @ZachRoberts I might be missing the question if so my apology.

 

 

add a gallery and

Items = Filter(TableA ,OrderID=GalleryWhichUserWillSelectOrder.Selected.OrderID)

add the TestId and description labels, add another label and set its

text = LookUp(TableB, TestID = ThisItem.TestID,'Test Description')

 

GalleryA

rubin_boer_0-1613151696852.png

 

GalleryB

rubin_boer_1-1613151715843.png

 

GalleryC

rubin_boer_2-1613151740308.png

 

 

hope this helps

 

 

@rubin_boer  Thanks for the reply, sorry my initial question may of been confusing. 

 

Well that works for creating a gallery to display the tests and test descriptions for the selected orderID I am trying to get the description in a collection so I can output a table like below, there will be a button on this power app that allows a PDF of the order details and tests to be generated.

 

test collection (for selected order ID)

TestIDTest Description
T01T01 Desc
T02T02 Desc

 

Do you know of a way to get these items in the same table when I create that collection?

 

Thanks

 

 

 

 

 

 

ZachRoberts
Resolver I
Resolver I

@rubin_boer  I basically need to perform a join when creating my collection if that is possible with power apps. Should be able to join the data into a single collection since they should be relatable through the testID.

 

Thanks

ZachRoberts
Resolver I
Resolver I

Hey I was able to solve this issue. 

 

I did some more googling and came across this post here: Solved: Re: Creating collection from multiple tables - Power Platform Community (microsoft.com)

 

I followed the approach to create a separate collection where you would join the other 2 data sources in. Thanks everyone for your help 😊

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (3,825)