Hi All,
I've had a headache for days about the following:
I have 2 Sharepoint lists as database: Training and Registrations.
A training can contain several sessions. Think of it as a kind of Header-Line construction.
The Registration table lists all registrations to a training and associated sessions.
In my PowerApp I made a screen in which a trainer can mark the participants as present or absent. When the session is over, the trainer can complete the session. The screen contains a Gallery (galAttendees) with the participants per session.
It is the intention that when a participant has completed all sessions, the registration for the training will also be completed.
As an example:
Training table:
ID Name Type TrainingId
376 Demo Training
425 Day 1 Session 376
426 Day 2 Session 376
427 Day 3 Session 376
Registrations table
ID User Training:ID Training2 Status
390 Person1 376 376
391 Person1 425 376 Completed
392 Person1 426 376 Completed
393 Person1 427 376 Completed
394 Person2 376 376
395 Person2 425 376 Not completed
396 Person2 426 376 Completed
397 Person2 427 376 Completed
In this example, Person1 has completed all 3 sessions and therefore ID 390 must be set to “Completed”.
Person2 has completed 2 of the 3 sessions and therefore ID 394 must be set to “Not completed”.
How can I achieve this?
I tried in a forall with a CountRows to compare the number of completed sessions with the number of Sessions of the training but unfortunately I get no results in the gallery
ClearCollect(
colAttendees,
ForAll(
galAttendees.AllItems,
CountRows(
Filter(
Registrations,
gblTraining.TrainingId.Id = Training2.Id && ThisRecord.Status.Value = "Completed" && DeelnemerId = ThisRecord.DeelnemerId
)
) = CountRows(
Filter(
Trainingen,
gblTraining.TrainingId.Id = ThisRecord.TrainingId.Id
)
)
)
)