web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create a Collection fr...
Power Apps
Answered

Create a Collection from multiple related SharePoint lists

(0) ShareShare
ReportReport
Posted on by 1,117

I have SharePoint lists as shown below.

 

List A

IDJob Number (Text)Site Address (Text)Supervisor (Text)
44C20-65PRINCE OF WALES AV, MILL PARK REHABNick

 

List B

IDJob ID (number column reference to ID column of List A)Machinery (Multi Select Choice Column)Crew Member(Text)
144DPU, CIVIL Truck - 9David
244BOBCAT-6, BOBCAT-5Benjamin

 

List C

IDJob ID (number column reference to ID column of List A)Machinery (Multi Select Choice Column)Crew Member (Text)
144Tipping-Truck-5, Tipping-Truck-6Ethan

 

My resultant table or collection should look like below

Job Number Site AddressSupervisorMachinery List BCrew Member List BMachinery List CCrew Member List C
C20-65PRINCE OF WALES AV, MILL PARK REHABNickDPU, CIVIL Truck - 9DavidTipping-Truck-5, Tipping-Truck-6Ethan
C20-65PRINCE OF WALES AV, MILL PARK REHABNickBOBCAT-6, BOBCAT-5Benjamin  

 

Can someone help in writing a collection function to get me the resultant table. I initially tried using Power Automate to get into a csv but the format of table is going completely wrong with my flow. I though achieving this in PowerApps is bit straight. 

 

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @RameshMukka 

    You would use the AddColumns() function to lookup the items from another list.  Something like

    ClearCollect(
     mycollection, AddColumns(
     ListA,"Machinery",Lookup(
     ListB, JobID=ID, Machinery
     )
     )
    )
  • rameshmukka Profile Picture
    1,117 on at

    @Drrickryp I tried your formula like below but its throwing error at JobID = ID.

     

    ClearCollect(
     colJobitems,
     AddColumns(
     ShowColumns(
     'Site Startup',
     "ID",
     "JobNo",
     "JobName",
     "SiteAddress",
     "Weather",
     "CrewSupervisor"
     ),
     "Labour",
     LookUp(
     'Site Labour',
     JobID = ID
     ).CrewMembers
     )
    )

     

    RameshMukka_0-1609559808888.png

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    It assumes the foreign key is jobid but it could be whatever you have chosen as the link field between the tables.

  • rameshmukka Profile Picture
    1,117 on at

    @Drrickryp Yes JobID is the foreign key here.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Lookup('Labor Site',ID=JobID, crewmembers) would show a field value for crewmembers.

    The order in the equation is table, primary key = foreign key ,fieldname

  • rameshmukka Profile Picture
    1,117 on at

    @Drrickryp What I have in list 'Site Labour' is foreign key JoBID. So comparing it with ID (primary key) of list 'Site Startup'. I would like to fetch column CrewMembers (text column) when this condition is met in LookUp function. But it could return 1 or more records as I have 1 or more matching records with my primary key. Do you think thats the problem? I hardly see any other issue.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @RameshMukka 

    Are you saying that the relationship between the two lists is one to many?  ie. one Job to many SiteLabor.  If this is the case and you want to show all the crew members on a particular job.  I would approach the problem a different way.

  • rameshmukka Profile Picture
    1,117 on at

    @Drrickryp You are right! One job to many SiteLabor. Also the same case with my List C that I mentioned in my post. I actually have to join similar lists into a single collection. Just wanted a path for one list so I can replicate the same with other lists.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @RameshMukka 

    The best way to work with this kind of data, where you want to show all of the crew for a single job is to use the GroupBy() function on the Many side and to show the results with a Gallery/Subgallery.  In the example below a table  of fake contacts is grouped on state and the rest of the data is shown in the subgallery.  In your case, you would group the crew members by "jobID" and show the names in the subgallery.  You would show additional information about the Job using labels with a text property of  Lookup(Job, ID=jobID, siteaddress), etc for items you want to show related to the Job itself in the outer gallery.  That is the way you can show the items you selected by ShowColumns() in your original post.  _1.png

  • rameshmukka Profile Picture
    1,117 on at

    @Drrickryp The actual target is to get the csv from collection by sending it to Power Automate flow. Showing on gallery was never part of my plan 😞

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 70

#2
WarrenBelz Profile Picture

WarrenBelz 64 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 36 Super User 2026 Season 1

Last 30 days Overall leaderboard