cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Patching Sharepoint list from checkbox control

Hello all,

 

I have become stuck while trying to make a checkbox within a gallery update a sharepoint list item. 

 

In short, I am using powerapps to make a task list app for several of our District Managers. My functionality for letting them mark their tasks as complete is working just fine. 

 

My issue is that I do not have an easy way to mark tasks complete for them. Many of them have issues reaching the app or remembering to mark tasks as complete. To help them out, I am trying to create a master control that lets me manually mark when they have completed tasks. 

 

I am doing this by creating a gallery with all of their names (contained in its own sharepoint list). The gallery contains its own checkbox for each district manager name, which ideally will be checked and unchecked depending on whether or not the task is complete.

 

To mark tasks as complete, I have set Its OnCheck property to:

 

Patch(
'Tasks Due', //The task list data source
Sel_item, //The Selected Task
{
Who_Completed: //The comma separated text list of who has completed the task

Concatenate(
ThisItem.Title, //The name of the District Manager
",",
Text(Sel_item.Who_Completed) 
)

}
)

 

In case I need to remove a district manager from the list of "who completed" I have set this function in the OnUncheck property:

 

//This function substitutes the list of who completed for the list of who completed minus the name of the person who was just unchecked in that list.

 

Substitute(
Sel_item.Who_Completed,
Concatenate(
ThisItem.Title,
","
),
"",
1
)

 

My issue is that it's not patching the data source when I check or uncheck those boxes, despite the system listing no errors. The kicker-- this funciton sort-of works when I combine it in the "OnSelect" property using a few if statements. For some reason it doesn't like it when I separate it as above (even though I think this will work better) What am I doing wrong? 

 

PS-- Let me know if you need more info. I have a lot of different functions and data sources hooked up to this. 

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Responsive Resident
Responsive Resident

Re: Patching Sharepoint list from checkbox control

I have to republish your syntax with the code format to make it readable:

Patch('Tasks Due', //The task list data source
  Sel_item, //The Selected Task
  {
    Who_Completed: //The comma separated text list of who has completed the task
Concatenate(
ThisItem.Title, //The name of the District Manager ",", Text(Sel_item.Who_Completed) ) } )
Substitute(Sel_item.Who_Completed,
  Concatenate(ThisItem.Title, ","), "", 1
)

 

Based on my understanding, what you may want to try to do is something like this:

Let's assume you have a galleryManagers, which has a checkbox and its Title is set to each District Manager's name. Let's say record(1).Title = "Bill", record(2).Title = "Bob", record(3).Title = "John". And each of galleryManagers datacard has an object called CheckBox1, you can do something like this:

Concat(
  Filter(galleryManagers, CheckBox1.Value=true)
  Title,
  ","
)

What this does is it filters your gallery of managers for only those whose CheckBox1.Value is true, and then it concatenates the Title (assuming Title = their name). So if record(1) and record(3) are checked, it will return "Bill,John".

I'm not sure how that fits into your question, but maybe that's a good starting point (?).

 

View solution in original post

3 REPLIES 3
Highlighted
Responsive Resident
Responsive Resident

Re: Patching Sharepoint list from checkbox control

I have to republish your syntax with the code format to make it readable:

Patch('Tasks Due', //The task list data source
  Sel_item, //The Selected Task
  {
    Who_Completed: //The comma separated text list of who has completed the task
Concatenate(
ThisItem.Title, //The name of the District Manager ",", Text(Sel_item.Who_Completed) ) } )
Substitute(Sel_item.Who_Completed,
  Concatenate(ThisItem.Title, ","), "", 1
)

 

Based on my understanding, what you may want to try to do is something like this:

Let's assume you have a galleryManagers, which has a checkbox and its Title is set to each District Manager's name. Let's say record(1).Title = "Bill", record(2).Title = "Bob", record(3).Title = "John". And each of galleryManagers datacard has an object called CheckBox1, you can do something like this:

Concat(
  Filter(galleryManagers, CheckBox1.Value=true)
  Title,
  ","
)

What this does is it filters your gallery of managers for only those whose CheckBox1.Value is true, and then it concatenates the Title (assuming Title = their name). So if record(1) and record(3) are checked, it will return "Bill,John".

I'm not sure how that fits into your question, but maybe that's a good starting point (?).

 

View solution in original post

Highlighted
Frequent Visitor

Re: Patching Sharepoint list from checkbox control

Aha! I hadn't thought about submitting the entire gallery each time. That's a good idea. I will give it a shot.

Highlighted
Frequent Visitor

Re: Patching Sharepoint list from checkbox control

Amazing, apparently that was what it needed. Thanks for the help! 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,973)