cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cyarbrough
Helper III
Helper III

Combine two columns from two different sources?

i'm going to start from the very beginning of what i'm doing, so if i'm making this way too complicated someone can tell me.

 

i'm making an app that's a directory of parts where i can also create bills of materials and view them. when viewing a BOM, i want to see a list of all the required parts and be able to click them to open the info for that particular part. i have the part directory finished and i know how to do the last bit with clicking through to part info, but i'm running into some problems displaying the bill of materials.

 

here's how i'm making and saving them:

 

 

f0.png

so the record looks like this in the BOM entity:

 

f1.png

 

here's where the problem comes in. when i view the BOM, i want to see the parts and their quantities in a gallery -- to do that, i need to split both of these strings and make them into a 2-column collection?

 

this is my onvisible for the BOM view page and the resulting collections:

f2.png

 

so, in theory, all i need to do is combine both of these collections into one 2-column collection, then put that into a gallery. i can't figure out how to do that without ending up with at least one column being a nested table. can someone help?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello cyarbrough,

Maybe not the easiest way but until we find it you can use this:

ClearCollect(counter,0);
Clear(Combined);
ForAll(bomparts,
Collect(counter,Last(counter).Value+1);
Collect(Combined,{
bomparts:Last(FirstN(bomparts,Last(counter).Value)).Result,
bomquan:Last(FirstN(bomquan,Last(counter).Value)).Result
}))

View solution in original post

5 REPLIES 5
v-monli-msft
Community Support
Community Support

Hi @cyarbrough,

 

This means that you need to join columns from 2 data sources in one gallery, please take below thread as reference and see if this could help:

https://powerusers.microsoft.com/t5/General-Discussion/Can-I-add-fields-from-multiple-data-sources-i...

 

Regards,

Mona

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

Hello cyarbrough,

Maybe not the easiest way but until we find it you can use this:

ClearCollect(counter,0);
Clear(Combined);
ForAll(bomparts,
Collect(counter,Last(counter).Value+1);
Collect(Combined,{
bomparts:Last(FirstN(bomparts,Last(counter).Value)).Result,
bomquan:Last(FirstN(bomquan,Last(counter).Value)).Result
}))

View solution in original post

thanks, mike8. i figured out how to get everything working how i wanted based on the formula you gave me.

newpeter0
Frequent Visitor

Thank you. I have spent quite some time trying to figure out similar problem, and then your solution popped out working like a charm. Cheers.

Altino
Regular Visitor

Hello, does the funciton that a  colleague placed only return the last record in the table ? 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (16,375)