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 / Add one or more rows t...
Power Apps
Answered

Add one or more rows to junction table based on combobox selected items

(0) ShareShare
ReportReport
Posted on by

I have hit the limit of lookup fields SharePoint allows in my list (tblProjects) but need to relate one or more permits (from tblPermits) to each project. So I want to use a separate junction table (tblProjects_Permits) with two fields, a single-value lookup (Project) referencing tblProjects and a single-value lookup (Permit) referencing tblPermits. Basic schema like this:

 

_nerdy_0-1643527874487.png

 

I have a PowerApps form for data entry to tblProjects with a combobox that lets me select one or more permits. Like this:

_nerdy_1-1643528001814.png

When the form is submitted I want it to add a row to tblProjects_Permits with the project name in Project and the permit name in Permit for each permit selected in the combobox. So if I'm on the form for Project One and selected in the permits combobox Permits 001 and 229 it would add two rows to tblProjects_Permits like this:

_nerdy_2-1643528240484.png

 

I'd also need it to delete rows that are deselected if I happen to go back to the form to edit a project later. 

 

I've been able to add a custom card to the form and add a multiselect combobox with Items coming from tblPermits. But I don't know how to get it to add or delete rows in tblProjects_Permits with the relevant project and permit. I'm thinking Patch but how to iterate through selected items in the combobox? And how to get the ID of the project if it is new? 

 

Categories:
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @_nerdy ,

     

    "but how to iterate through selected items in the combobox"

     

    You could use ForAll() function.

    ForAll(Combox.SelectedItems,...)

     

    "And how to get the ID of the project if it is new? "

     

    You could set a variable to save the return value from patch function.

    Set(var,Patch(...).ID)

     

    Best Regards,

    Wearsky

  • SF-30110036-0 Profile Picture
    on at

    Thanks @v-xiaochen-msft and apologies for such a delayed response 👍 This pointed me in the right direction.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard