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:
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)
Woohoo that worked! Awesome, thank you so much. Appreciate it 🙂 Happy holidays
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)),
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.
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.
Getting the following error:
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.
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional