Hi,
I have some understanding with checkboxes on Powerapps. I have on specific column a multi choice option : for example, I have some checkboxes where each of them has a specific value and different values : a, b, c and d.
This is my onCheck, OnUncheck, OnSelect and Default on one of them :
- OnCheck
ClearCollect( Collection1; If(Checkbox1.Value;"a"); If(Checkbox2.Value;"b"); If(Checkbox3.Value;"c"); If(Checkbox4.Value;"d") )
- OnUncheck
ClearCollect( Collection1;Filter( Collection1; !IsBlank(Value) ) );;
- OnSelect
Collect(Collection1; 'Données');;
- Default
If( { '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"; Id: 1; Value: "a" } in Matériel_DataCard1.Default; true; false
When I check for the first time the checkbox this work fine, and I see my value inserted on my multi choice column. However, when I unchecked one checkbox (for example I have unchecked the checkbox1 and checked the checkbox2), on my multi choice the value of the first checkbox wasn't removed and the value of the second was added.
How can I remove the value of my checkboxes when I unchecked them ?
Thanks for your help.
Hi @Anonymous ,
Do you want to use check box to update a multiple choice column?
I've tested your formula, this will not create a collection with the data that you select.
I've made a similar test for your reference:
1)insert 4 check boxes
2)Set the check boxes's OnCheck:
ClearCollect(Collection1,
{Value:"a",data:Checkbox1.Value},
{Value:"b",data:Checkbox2.Value},
{Value:"c",data:Checkbox3.Value},
{Value:"d",data:Checkbox4.Value})
In my way, you do not need to set the OnUnCheck property.
Here's the collection1 that I create: (I choose a,c,d as an example)
3)Set the submit button's OnSelect:
Patch(listname,Defaults(listname),{fieldname:Filter(Collection1,data=true)})
Please consider the data's format that the multiple choice column needs.
The data format should be like this:
So using filter function to filter the checkbox value equal to true will lead to this result.
Best regards,
Hi @v-yutliu-msft thanks for your help.
I was testing each of your points, but when I write the function
Patch(listname,Defaults(listname),{fieldname:Filter(Collection1,data=true)})
I see an error : 'the column fieldname doesn't exist'. I tested with the column name 'Value', but i have the same error.
Regards,
Nosmoz.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
257 | |
247 | |
82 | |
36 | |
30 |
User | Count |
---|---|
299 | |
267 | |
117 | |
66 | |
45 |