cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NurSabrina24
Helper I
Helper I

Display SP List A in PowerApps Gallery to Submit into SP List B

Hi, 

 

I am creating an attendance app that use gallery to display rows of data from a sharepoint list (Let's say, it's a SP List A). In the gallery, I'd included label of "Display Name" and "Class Name" and checkbox for each name to be selected. I have 2 buttons of "Presence"  and "Absence" where teachers will tick checkbox for each student name and click the either one of the buttons which if selected students are those who present, teacher will click "Presence" button. So after teacher clicked the button, I want it to be submitted to another SP List for attendance checklist (SP List B). 

 

Could someone please help me on this? Thank you. 

 

NurSabrina24_1-1656051531370.png

Here's the SP List A that consists of "Display Name", "Username" for email and "Class Name". 

 

NurSabrina24_2-1656051599166.png

Here's the Gallery to display name list from SP List A which the name is from "Display Name" and "Class Name" hidden label and checkbox. 

 

 

NurSabrina24_0-1656051445197.png

Here's the SP List B.

 

Thank you. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @NurSabrina24 ,

 

For the Check boxes in the Gallery, you need to append collections on OnCheck and OnUncheck properties in order to collect the checked items of list A, and for the two buttons, you shall leverage the Patch function to add new rows to list B (or RemoveIf function to delete rows) based on the collection.

 

OnCheck:

Collect(colAttendees, ThisItem)

OnUncheck:

Remove(colAttendees, ThisItem)

OnSelect of Absence:

ForAll(colAttendees, RemoveIf(ListB, DisplayName = ThisRecord.DisplayName))

OnSelect of Presence:

ForAll(colAttendees, Patch(ListB, Defaults(ListB),{DisplayName: ThisRecord.DisplayName, ......}))

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
v-jefferni
Community Support
Community Support

Hi @NurSabrina24 ,

 

For the Check boxes in the Gallery, you need to append collections on OnCheck and OnUncheck properties in order to collect the checked items of list A, and for the two buttons, you shall leverage the Patch function to add new rows to list B (or RemoveIf function to delete rows) based on the collection.

 

OnCheck:

Collect(colAttendees, ThisItem)

OnUncheck:

Remove(colAttendees, ThisItem)

OnSelect of Absence:

ForAll(colAttendees, RemoveIf(ListB, DisplayName = ThisRecord.DisplayName))

OnSelect of Presence:

ForAll(colAttendees, Patch(ListB, Defaults(ListB),{DisplayName: ThisRecord.DisplayName, ......}))

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi, 

 

Do you know how if I want to declare that if the teacher click the 'Presence' button, in the list B will update to presence value?

 

I've tried: 

ForAll(PER, Patch('SEMINDA ... Checklist', Defaults('SEMINDA ... Checklist'), {'Presence/Absence': "Presence", 'Student Name': ThisRecord.'Display name', 'Class Name': ThisRecord.'Class Name'}))

so here's my OnSelect for 'Presence' button. From the word Patch to the last ')' is error.

 

Do you think there is any mistakes I'd made? colAttendees is the listA name, right? 

 

so for mine are, 

  • colAttendees = listA = PER
  • listB = SEMINDA .... Checklist

 

Thank you. 

Hi @NurSabrina24 ,

 

No, colAttendees is the collection that updated by the Check boxes. List A will only display in the Gallery.

 

Best regards,

 

 

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,970)