cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Combining two Collections of different columns

Hello Community,

Below is a mock of my Collection1

SId  ItemID  Desc    QtyNeeded

1        100    Water          2

2        106    Pen             6

 

I have another collection namely Collection2, which collects records after patched into a datasource.

TransID    UserName    Type   TransDate

12            John             Inv       9/25/2019

13           John              Inv       9/25/2019

 

The TransID is an auto generated column in the datasource. How do I add TransID to the Collection1? I'd like to add TransID to Collection1 and then Patch all records of Collection1 to another table in the datasource.

Can I acheive using Variables? Please help. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User II
Dual Super User II

Re: Combining two Collections of different columns

Hi @Kitz 

 

Not sure if the approach is correct from a data mapping standpoint

 

But if you want to merge the 2 - assuming Sid is the unqiue key in collection 1 and defines the item index

 

then sid 1 will map to trans id 12

sid 2 - trans id 13 and so on

 

ClearCollect(col3, AddColumns(collection1,"TransID",Last(FirstN(collection2,Sid)).TransID))

 

where col3 is the new collection

 

collection1 - is your first collection with sid

collection2 - is your second collection with transid

 

Regards,

Reza Dorrani

 

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

4 REPLIES 4
Highlighted
Dual Super User II
Dual Super User II

Re: Combining two Collections of different columns

@Kitz 

 

whats is the link between the 2 collections

Item count will always be same? 

 

so do u need

 

SId  ItemID  Desc    QtyNeeded   Trans ID

1        100    Water          2              12

2        106    Pen             6              13

 

Highlighted
Helper I
Helper I

Re: Combining two Collections of different columns

Hi @RezaDorrani ,

Yes, I need a collection in the format you have mentioned. Unfortunately, there is no link between the two Collections and the ItemCount won't be same.  Is there any way we can use variables to acheive this? 

Thanks!

Highlighted
Dual Super User II
Dual Super User II

Re: Combining two Collections of different columns

Hi @Kitz 

 

Not sure if the approach is correct from a data mapping standpoint

 

But if you want to merge the 2 - assuming Sid is the unqiue key in collection 1 and defines the item index

 

then sid 1 will map to trans id 12

sid 2 - trans id 13 and so on

 

ClearCollect(col3, AddColumns(collection1,"TransID",Last(FirstN(collection2,Sid)).TransID))

 

where col3 is the new collection

 

collection1 - is your first collection with sid

collection2 - is your second collection with transid

 

Regards,

Reza Dorrani

 

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

Highlighted
Helper I
Helper I

Re: Combining two Collections of different columns

Wow.. it works! Thank you so much

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published 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 (6,344)