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 multiple rows to g...
Power Apps
Answered

Add multiple rows to gallery based on column value

(0) ShareShare
ReportReport
Posted on by 237

Hi,

 

I have an editable grid that patches to a SharePoint list. As of right now, the add row button adds in 1 row at a time with some of the values already preset when the row is added. I have a column named "EventDays" in the parent sharepoint list and need the add row button to add x amount of rows based on the "EventDays" value. "EventDays" is a calculated column in the sharepoint list. So if the "EventDays" = 5 rows, the add row button should add 5 rows at once. I still want the ability for the rows to have the preset values there. Any help is appreciated!

 

here is my screen:

NPatel12498_0-1702409796520.png

 

Add Row On Select:

Patch(
 'Checklist Details',
 Defaults('Checklist Details'),
 {Title: Last('Event Information').ID},
 {'Event Date': Last('Event Information'). 'Event Start Date'},
 {'Event Zip': Last('Event Information'). 'Event Zip Code'},
 {'NNAttendees': Last('Event Information'). 'NN Attendees'},
 {'N Attendees': Last('Event Information').'N Attendees'}
);
Set(varReset,false);
Set(varReset,true);

ClearCollect(colPerDiemRate,Table1);

 

Gallery Items:

Sort(
 Filter(
 'Checklist Details',
 varReset),
 Modified,
 SortOrder.Descending)

 

Save On Select:

Patch(
 'Checklist Details',
 ShowColumns(
 colMealUpdates,
 "Title",
 "Event_x0020_Date",
 "Event_x0020_Duration_x0020__x002",
 "N_x002d_N_x0020_Attendees",
 "N_x0020_Attendees",
 "Per_x0020_Diem_x0020_Rate",
 "Per_x0020_Diem_x0020_Total",
 "Required_x0020_Meals",
 "ID",
 "Total_x0020_Attendees",
 "Event_x0020_Zip"
 )
);
Notify(
 "Meal details have been updated successfully",
 NotificationType.Success,
 3000
);
Clear(colMealUpdates);
Set(varReset,false);
Set(varReset,true);
Navigate(TrackingScreen)

 

Categories:
I have the same question (0)
  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    I can't remember if PowerApps can use calculated column for the value. If you can then you could just wrap your existing Patch in a ForAll

     

    ForAll ( Sequence( Value(Lookup(Parent Sharepoint list, ID = however you get the row from this list).EventDays)), 

     

    Patch Logic 

     

    )

     

    This will run it 5 times. If Event Days is 5. 

     

    This assumes the 5 rows use the same data. If it's different data then Will need a different approach. 

  • NP-18101421-0 Profile Picture
    237 on at

    Getting the following error:

    NPatel12498_1-1702415416086.png

     

     

  • cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    Your Lookup() is all over the place, need to put a label out and put in the lookup to get your eventdays properly. Once you have that take and replace the lookup inside the Value(). 

     

    You could also replace the Value() with a 5 and test it make sure it works how you want, then figure plug in the Value(Lookup()) that pulls the Eventdays in.

  • NP-18101421-0 Profile Picture
    237 on at

    The look up function wont work because the parent list has a one to many relationship with the list in the gallery... so that is why it keeps throwing an error.

  • Verified answer
    cwebb365 Profile Picture
    3,294 Most Valuable Professional on at

    Lookups work fine in that case, it returns the first entry. I don't understand your schema enough to tell you what to do. You need to somehow find the Event days on a label. Once you do that you can use that Code block inside the sequence to loop through and create that many records. 

     

    Based on some of the code in your original post looks like you're just going off the last Event Information entry using Last. So you could probably use 

    ForAll( Sequence(Value(Last('Event Information').EventDays)), 

     

  • NP-18101421-0 Profile Picture
    237 on at

    Woohoo that worked! Awesome, thank you so much. Appreciate it 🙂 Happy holidays

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard