Hi,
I am using a sequence function to add rows based on the # of event days in my editable gallery. The function works fine. However, after the rows get added and the user populates the data and goes to hit submit, after selecting submit, the gallery ends up adding the same number of rows again. If I use the +New button, which adds 1 row at a time and then hit submit, this issue doesn't happen.
See formula for adding rows based on number of event days:
ForAll(
Sequence(Value(varRecord.EventDays)),
Patch(
'Checklist Details',
Defaults('Checklist Details'),
{Title: varRecord.ID},
{'Event Date': varRecord.'Event Start Date'},
{'Event Zip': varRecord.'Event Zip Code'},
{'Non Attendees': varRecord.'Non Attendees'},
{'Attendees': varRecord.'Attendees'},
{'Required Meals':LookUp(Choices('Checklist Details'.'Required Meals'),Value="-")},
{
'Event Lookup': {
Value: varRecord.Title,
Id: varRecord.ID
}
}
));
Formula to add 1 row at a time:
Patch(
'Checklist Details',
Defaults('Checklist Details'),
{Title: varRecord.ID},
{'Event Date': varRecord.'Event Start Date'},
{'Event Zip': varRecord.'Event Zip Code'},
{'Non Attendees': varRecord.'Non Attendees'},
{'Attendees': varRecord.'Attendees'},
{'Required Meals':LookUp(Choices('Checklist Details'.'Required Meals'),Value="-")},
{
'Event Lookup': {
Value: varRecord.Title,
Id: varRecord.ID
}
}
);
Select(btnLoadMeals);
ClearCollect(
colPerDiemRate,
Table1
);
Submit button formula:
Patch(
'Checklist Details',
ShowColumns(
colAddMealsUpdates,
"Title",
"Event_x0020_Date",
"Event_x0020_Duration_x0020__x002",
"Non__x0020_Attendees",
"Attendees",
"Per_x0020_Diem_x0020_Rate",
"Per_x0020_Diem_x0020_Total",
"Required_x0020_Meals",
"ID",
//"Total_x0020_Attendees",
"Event_x0020_Zip",
"EventLookup"
)
);
If(
varEditButton<>1,
Patch(
'Event Information',
LookUp(
'Event Information',
ID = varRecord.ID
),
{'Workflow Status': {Value: "In Progress"}}
),
Patch(
'Event Information',
LookUp(
'Event Information',
ID = varRecord.ID
),
{'Workflow Status': {Value: "Resubmit"}}
));
Select(btnLoadMeals);
Navigate(Screen2);
Editable screen gallery
After hitting submit, the 3 highlighted got added again:
