cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Checkbox can remove his value on a multichoice column in sharepoint list ?

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.

 

 

 

2 REPLIES 2
v-yutliu-msft
Community Support
Community Support

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)8192.PNG

 

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:8193.PNG

So using filter function to filter the checkbox value equal to true will lead to this result.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

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.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (43,298)