Hi,
I have an app which uses the SharePoint Calendar/List as the data source. This app is used for timetabling which allows to add courses for a teacher is a recurring event, but creates a new row per item (i.e. it’s own ID).
For the below Screen called ‘Add Event’, I have the following set of codes for the OnVisible property:
ClearCollect( timeEntriesCollection,
{
LessonNo: 1,
Attendees: "",
Course: "",
Category: "",
Location: "",
'Start Time': Now(),
'End Time': Now(),
Teacher: ""
})
Here is what the screen looks like:

The PLUS icon has the following code:
Select(Parent);
Patch(
timeEntriesCollection,
ThisItem,
{
LessonNo: Value(lblLessonNo.Text),
'Start Time': StartDatePicker.SelectedDate + Time(Value(ddStartHour.Selected.Value), Value(ddStartMinutes.Selected.Value),0),
'End Time': EndDatePicker.SelectedDate + Time(Value(ddEndHour.Selected.Value), Value(ddEndMinutes.Selected.Value),0)
}
);
Collect(
timeEntriesCollection,
{
LessonNo: lblLessonNo + 1,
'Start Time': DateAdd(StartDatePicker.SelectedDate,7,Days) + Time(Value(ddStartHour.Selected.Value), Value(ddStartMinutes.Selected.Value),0),
'End Time':DateAdd(EndDatePicker.SelectedDate,7,Days) + Time(Value(ddEndHour.Selected.Value), Value(ddEndMinutes.Selected.Value),0)
}
)
The SAVE icon has this code:
ForAll(
galleryClassAdd.AllItems,
Patch(
Timetable Test',
Defaults(‘Timetable Test'),
{
Course: toptxtCourse.Text,
Location: toptxtLocation.Text,
'Start Time': If(Checkbox1.Value=false, StartDatePicker.SelectedDate + Time(Value(ddStartHour.Selected.Value), Value(ddStartMinutes.Selected.Value),0), StartDatePicker.SelectedDate + Time(0,0,0)),
'End Time': If(Checkbox1.Value=false, EndDatePicker.SelectedDate + Time(Value(ddEndHour.Selected.Value), Value(ddEndMinutes.Selected.Value),0), EndDatePicker.SelectedDate + Time(23,59,59)),
Attendees: TeacherSelector.Selected,
Category: CategorySelector.Selected,
LessonNo: If(Not(CategorySelector.Selected.Value="Weekend"),"Session - " & lblLessonNo.Text),
Teacher: First(Split(TeacherSelector.Selected.Email,"@")).Result
}
)
)
PROBLEM
I now need a way to be able to edit the events in a similar way as adding by loading all related events under the same COURSE (title) name.
I have tried this with a gallery - But cannot get it to function:

Gallery Items:
Distinct(
SortByColumns(
Filter(
'Timetable Test',
Category.Value = Dropdown1.Selected.Value
),
"EventDate",
Descending
),
Course
)
And for the chevron icon (>), on select code is:
Select(Parent);
Set(
selectedEvent,
ThisItem
);
ClearCollect(
selectedTimeEntries,
Filter(
'Timetable Test',
Course = selectedEvent.Result
)
);
Navigate(EditEvent)
The highlighted gives me an error saying:

I want this now to take me to the EDIT Screen which should look very much like the Add screen but list all the events stored for the selected Course. But I do not know how to take it forward from here.
On the EDIT SCREEN, I have the gallery items set to selectedTimeEntries:
The ADD icon as below but with errors:

If someone could please help or guide me how to load items to edit which has the same COURSE name.
I've tried to follow April Dunnam's amazing app but fail on the edit screen (https://youtu.be/A8SiNTnQw0Q).
Thank you in advance.