web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Update SharePoint List...
Power Apps
Answered

Update SharePoint List items compare CountRows

(0) ShareShare
ReportReport
Posted on by 112

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
 )
 )
 )
)

 

 

Categories:
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @RobMolenaar ,

     

    Do you want to put the people who complete all sessions into a collection?

    Based on your description, I have made a simple test for your reference.

     

    Here is my app:

    Formula:

    ClearCollect(test2,Distinct( ClearCollect(test,
    ForAll( RegistrationTable, {Name:User}));, Name ));
    ClearCollect(colAttendees,
    Filter(ForAll( test2 As tt,
    If( CountRows(Filter(RegistrationTable, Status = "Completed", tt.Result = ThisRecord.User)) = 3,
    { registedPerson: tt.Result})
    ),!IsBlank(registedPerson)))

     

    vjefferni_0-1666779921416.png

     

    Result screenshot:

     

    vjefferni_1-1666779921418.png

     

    Best Regards,

  • RobMolenaar Profile Picture
    112 on at

    Hi @v-jefferni ,

     

    Thank you! You got me on the right track. I couldn't have come up with it myself. With the result I want to update the column 'Status' with "Completed" in this record in the SP list Registration.

    2022-10-28_09-25-44.png

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @RobMolenaar ,

     

    If the Status column is a Text column, you could add this formula:

    ForAll(colAttendees,
    Patch(RegistrationTable,First(Filter(RegistrationTable, User = registedPerson)),{Status:"Completed"}))

    vjefferni_0-1667181182778.png

     

    But if it is a Choices column, the formula should be:

    ForAll(colAttendees,
    Patch(RegistrationTable,First(Filter(RegistrationTable, User = registedPerson)),{Status:{Value:"Completed"}}))

     

    Best regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard