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

Transforming multiple choice column to checkboxes in PowerApp

Hello,

 

I currently have a multiple choice column populated by three different choices.

In order to enhance the user's experience using the App, i wanted to change the format in powerApps using checkboxes instead.

 

On the card update field, I tried the following code:

If(CheckBox1.Value = true; "Option1"; If(CheckBox2.Value = true; "Option2"; If (CheckBox3.Value = true; "Option3"; "N/A")))

The error message was the following; the output is text and expected value is record.

 

 

Therefore, i tried changing the source column settings to single line of text and tried the same formula without success.

 

Is there a way to update a single field in the list based on three non-additive checkboxes choices ?

 

Thank you for the support,

 

Theo

1 ACCEPTED SOLUTION

Accepted Solutions
tommyly
Responsive Resident
Responsive Resident

 

I'm not used to seeing semi-colons in If-syntax. Try this:

 

If(CheckBox1.Value, "Option1",
  If(CheckBox2.Value, "Option2",
    If(CheckBox3.Value, "Option3")
  )
)

 If it's expecting a record, then you need to somehow cast it as a record.

 

For example:

If(CheckBox1.Value, Table({MyFieldName: "Option1"}),
  If(CheckBox2.Value, Table({MyFieldName: "Option2})",
    If(CheckBox3.Value, Table({MyFieldName: "Option3"}))
  )
)

 

I've found that when I'm working with SharePoint lists (and data types, e.g. text, number, choices, etc.), changing them in SharePoint Online and then working with them in PowerApps forms becomes quite temperemental. For example, if I have a field that is a Choice datatype and then, while working with the list in PowerApps, I change the dataType (in SharePoint) to string, it glitches. The PowerApps form will stubbornly still expect choice values (e.g. table values) but the datasource (SharePoint) will not accept table values (and fail).If you try to trick PowerApps by feeding it text values (which SharePoint would gladly accept), the PowerApps form will not allow you because it still believes the datatype is a Choice-type (and text is not a choice-type) and throw an error.

 

It will have you pulling your hair out because the only way I've found to fix it is to completely delete the column and all its existing data. Disconnect the form from the datasource. Refresh the form. Recreate the column and re-add its data. Then reconnect to the datasource in PowerApps and with the form .

 

Or.

 

Remove the datasource; delete the form; create a new form; then re-add the datasource; link the datasource to the newly created form.

View solution in original post

2 REPLIES 2
tommyly
Responsive Resident
Responsive Resident

 

I'm not used to seeing semi-colons in If-syntax. Try this:

 

If(CheckBox1.Value, "Option1",
  If(CheckBox2.Value, "Option2",
    If(CheckBox3.Value, "Option3")
  )
)

 If it's expecting a record, then you need to somehow cast it as a record.

 

For example:

If(CheckBox1.Value, Table({MyFieldName: "Option1"}),
  If(CheckBox2.Value, Table({MyFieldName: "Option2})",
    If(CheckBox3.Value, Table({MyFieldName: "Option3"}))
  )
)

 

I've found that when I'm working with SharePoint lists (and data types, e.g. text, number, choices, etc.), changing them in SharePoint Online and then working with them in PowerApps forms becomes quite temperemental. For example, if I have a field that is a Choice datatype and then, while working with the list in PowerApps, I change the dataType (in SharePoint) to string, it glitches. The PowerApps form will stubbornly still expect choice values (e.g. table values) but the datasource (SharePoint) will not accept table values (and fail).If you try to trick PowerApps by feeding it text values (which SharePoint would gladly accept), the PowerApps form will not allow you because it still believes the datatype is a Choice-type (and text is not a choice-type) and throw an error.

 

It will have you pulling your hair out because the only way I've found to fix it is to completely delete the column and all its existing data. Disconnect the form from the datasource. Refresh the form. Recreate the column and re-add its data. Then reconnect to the datasource in PowerApps and with the form .

 

Or.

 

Remove the datasource; delete the form; create a new form; then re-add the datasource; link the datasource to the newly created form.

View solution in original post

Anonymous
Not applicable

Hello Tommy,

 

Concerning the semi-colon, it is actually the propper synthax if the working environment is either french or german (if I'm not mistaken).

 

I took your advice and simply deleted the column, disconnected the datasource, recreated the column as text, reconnected the datasource and got rid of all the errors.

 

I was actually pulling my hairs on this because it should have worked, now I'm aware of those glitches.

 

Thank you for your help !

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,124)