Hi,
I have a gallery which displays a collection of students that a music teacher teaches for the day in addition to groups they take. It is created using this code (called fnLoadLessons):
ClearCollect(
colLessons,
ForAll(
Filter(
Sort(
InstrumentLessons,
ID,
SortOrder.Descending
), TeacherID = Text(varTeacher.ID), LessonDate = selectedDate
),
{
PupForm: LookUp(
StudentCoreData,
SchoolID = StudentID,
Form
),
PupSurname: LookUp(
StudentCoreData,
SchoolID = StudentID,
Surname
),
PupFirstName: (If(Len(StudentID) > 10,
LookUp(
StudentCoreData,
SchoolID = StudentID,
'Preferred Name'),
LookUp(
InstrumentalGroups,
GroupID = StudentID,
GroupName)
)),
TimePeriod: LookUp(
InstrumentLessonTimePeriods,
Text(TimeID) = LessonTimeID,
Title
),
TNotes: TeacherNotes,
TNotesByT: NotesbyTeacher,
Inst: Instrument,
TimeID: Value(LessonTimeID),
LessonID: ID,
Present: HasArrived,
Live: Published,
AttendanceStat: Attendance,
PupilID: StudentID
}
)
);
ClearCollect(
colLessons,
SortByColumns(
colLessons,
"TimeID",
SortOrder.Ascending
)
);
Currently the teacher selects the student, ticks a 'mark as present' box then presses a save button which runs this command:
SubmitForm(Form1); Set(varSelLesson, varSelectedLesson.LessonID);Select(fnLoadLessons);
The SubmitForm then updates the Sharepoint list but the teacher is then returned to the first person in the list. I found that just having the SubmitForm didn't seem to give enough time for the sharepoint list to update so when they clicked on save the form would come back unticked unless they refreshed the page again hence why I've added the Select(fnLoadLessons) at the end.
So my question is whether I can set the selected item in the gallery based on the varSelLesson variable.
Thank you for your help.