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

Welcome to the User Group Public Preview

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

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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (59,602)