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.

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,166)