How To Convert Out Of The Box PowerApps Dropdown To Checkboxes?

Overview

 
We implemented several Power Apps forms (customized SharePoint Forms) for a consulting firm based out of Alpharetta, Georgia, United States. When we customize our SharePoint form having a choice column, Power Apps represents the choices as a dropdown. For one of the forms we implemented, the requirement was to display checkboxes instead of a dropdown list for a choice column. So, how can we achieve this requirement? Let’s get started!
  1. Open your customized SharePoint Power Apps form.
  2. We need to add Checkboxes in the same data card as the dropdown. To add a checkbox, go to the insert menu and add a checkbox. Add checkboxes based on the # of choice value from the dropdown.

    How To Convert Out Of The Box PowerApps Dropdown To Checkboxes

  3. Now, we need to create one group for all checkboxes. In this group add default property using the below code.
    1. Self.Text in DataCardValue2.SelectedItems.Value   
    How To Convert Out Of The Box PowerApps Dropdown To Checkboxes
  4. For each Checkbox, we need to execute the below piece of code on both "OnCheck" and "OnUncheck" events. Add the following code to the "OnCheck" and "OnUncheck" events. The code is same for both the events for all the checkboxes.
    1. ClearCollect(ddtocb,  
    2.    If(Checkbox1.Value,Checkbox1.Text),  
    3.    If(Checkbox1_1.Value,Checkbox1_1.Text),  
    4.    If(Checkbox1_2.Value,Checkbox1_2.Text),  
    5.    If(Checkbox1_3.Value,Checkbox1_3.Text),  
    6.    If(Checkbox1_4.Value,Checkbox1_4.Text),  
    7.    If(Checkbox1_5.Value,Checkbox1_5.Text),  
    8.    If(Checkbox1_6.Value,Checkbox1_6.Text),  
    9.    If(Checkbox1_7.Value,Checkbox1_7.Text),  
    10.    If(Checkbox1_8.Value,Checkbox1_8.Text),  
    11.    If(Checkbox1_9.Value,Checkbox1_9.Text),  
    12.    If(Checkbox1_10.Value,Checkbox1_10.Text),  
    13.    If(Checkbox1_11.Value,Checkbox1_11.Text)  
    14. );  
    15. ClearCollect(ddtocb,Filter(ddtocb,!IsBlank(Value)))  
    How To Convert Out Of The Box PowerApps Dropdown To Checkboxes
  5. Now, select dropdown and open the DefaultSelectedItems property. Pass collection created in the above step using the following code snippet.
    1. If( IsEmpty(ddtocb),Parent.Default,ddtocb)  
    How To Convert Out Of The Box PowerApps Dropdown To Checkboxes
  6. Select final Data Card and change Update property using the following code snippet.
    1. If( IsEmpty(ddtocb),ThisItem.'<Field Name>',DataCardValue2.SelectedItems)   
    How To Convert Out Of The Box PowerApps Dropdown To Checkboxes
  7. At last, change the dropdown’s visible property to make it false.

Conclusion

 
This is how we can convert our dropdowns to checkboxes.