I put this is my button's "OnSelect" property.
ForAll(
Sequence(
DateDiff(
/*This is my start and end times and it breaks it down into 1 hour or 30 minute or 15 minute time slots This still needs work*/
ddStart.Selected.myDate,
ddEnd.Selected.myDate,
TimeUnit.Hours
) * If(
ddLength.Selected.Length = 30,
2,
If(
ddLength.Selected.Length = 15,
4,
1
)),
0
) As DATA,
Patch(TimeSlots,Defaults(TimeSlots),
{
RowNumber: DATA.Value,
EventDate: dpEventDate.SelectedDate,
TimeSlot: DateAdd(
ddStart.Selected.myDate,
ddLength.Selected.Length * DATA.Value,
TimeUnit.Minutes
),
Reserved: false,
Title: inpTitle.Text,
ReservedBy:"",
SlotLength: ddLength.Selected.Length,
/*this is a ComboBox as a people picker that saves to a Person Column*/
CounselorName: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & cbCounselorName.Selected.Mail,
DisplayName: cbCounselorName.Selected.DisplayName,
Email: cbCounselorName.Selected.Mail,
Department: cbCounselorName.Selected.Department,
JobTitle: cbCounselorName.Selected.JobTitle,
Picture: ""
}
}
)
);
/*This resets all my controls on the screen. Put the varReset in the "reset" property of all the control you want to reset when the button is clicked*/
UpdateContext({varReset: false});
UpdateContext({varReset: true});