Everything you need to know about the Dataverse Choice Column, including what a Dataverse Choice field is and how to construct one in the Dataverse table, will be covered in this Power Apps Dataverse tutorial.
I recently had to use and properly use the Dataverse Choice field in a Power Apps Form.
You may learn how to create a Power Apps Dataverse Choice field, how to apply it, and many other things by reading this Microsoft Dataverse guide. Examples include the ones below:
- What is Power Apps Dataverse Choice?
- Dataverse Choice vs Choices
- Dataverse Choice Vs Lookup
- How to create Dataverse Choice Column
- How to display Dataverse Choices in Power Apps
- Working with Power Apps Patch Choice Field Dataverse
- Working with Power Apps Filter Dataverse Choice Column
- How to filter Dataverse Choice Column by a Specific Value
- Power Apps Sort Dataverse Choice Column
- Power Apps Sort Dataverse Choice Column in Descending Order
What is Power Apps Dataverse Choice?
Users can select from a list of values in a choice column. They make data entry more efficient, which leads to accurate data. The two categories are local and global.
Local options are specific to the table and column for which they were built. They are not transferable to other tables. An application’s list of states, for instance, could not be applicable elsewhere (e.g. Australia, America, Brazil, Canada).
However, global selections are available in all tables and columns and can be reused. You have the option to make a new choice local when you create it by selecting the View more option.
A drop-down field is connected to choices once they are controlled as a separate list. Options assist ensure consistent data entry and increase the quality and utility of the data you collect when used appropriately and under strict management.
Also Read: Power Apps Dataverse Yes/No Field
Dataverse Choice vs Choices
The number of options that can be selected defines a choice from a choices column. A choice column just supports one option, whereas a choice column also supports the addition of numerous values.
Developers have two options when adding a choice column to a Dataverse table: they can choose from pre-existing lists of choices or make their own.
Dataverse Choice Vs Lookup
Choices are easier to understand when the list is short and the values are stable. They are beneficial because they are a component of the solution.
Lookups are necessary if the data is dynamic, users must add new values, or you need to record more information than simply the list item’s metadata.
For illustrate, having a lookup column for a list of cities is preferable since it enables the storage of additional data like area, population, etc. as part of the Cities table.
Check out: How To Get Row by ID From Dataverse Table
Create Dataverse Choice Column
Here we will see how to create a Choice Column in the Dataverse table called Book Purchase Info. The below image represents the specific Dataverse table.
Next to create the Dataverse Choice field, Follow the instructions below:
On the specific Dataverse Custom data table (Book Purchase Info), select the + New column (on the top bar). Enter the following fields in the New column pane:
- Display name = This column must be filled. Please enter the name of the choice column you want to create in the Dataverse database (let’s say Book Status).
- Description = Give a detailed description of the field that will be created. This column is optional.
- Data type = When the chevron is expanded, two options — Choice and Yes/no— are shown. To add a choice field, use the Choice data type.
- Behavior = Choose from Simple, Calculated, or Rollup as the field behavior.
- Required = It is available as a Business Recommended, Business Required, or Business Optional option.
- Searchable = A checkbox next to this option indicates that you want this field to be searchable. It is turned on by default.
- Selecting multiple choices is allowed = The user can select multiple-choice values if you enable this option.
- Sync with global choice? = This recommended field has two values in it:
- Yes (recommended) = This option can be used in numerous tables and will always be updated if the user chooses to enable it.
- No = If the user enables this option, a local choice that can only be used in one table is created. Its users are able to add additional options.
- Sync this choice with = You must fill this mandatory field with your selections. Click the + New choice option to create it.
Enter the values for the following fields in the New choice pane:
- Display name = Identify the choice values by their display name (Book Status). That implies that all the options will be saved under this name.
- Choices = In the field, there are two options. Such as:
- Label = Enter one or more numbers of options (like Delivered, Not Delivered, Shipping, etc.). Using the + New choice option, you can add more choices.
- Value = You can also provide their values if you so choose. It must fall within the range of 0 and 2147483646.
Additionally, as seen below, you can add custom colors to the chosen values and sort or remove any of them that you like.
Expand the Advanced options next to reveal the fields below:
- Name = it is a column already filled up and derived from the choice display name.
- External type name = This field is not required. The external name should be entered in the choice field.
- Description = Give the choice field’s description. It’s not required.
Save the new choice pane after everything is finished.
Expand the chevron next to “Sync this choice with” and then choose the Book Status you just created.
Click on the Edit choice option and make the necessary changes by clicking on the choice values you want to change.
Similarly to that, if you want to add choice values to a new category of the choice column, click on the + New choice option.
After filling out all the fields, Save the choice column as shown above. The new choice column in the Dataverse database is eventually ready for use.
This is how to create a Choice column in the Dataverse table.
Have a look: How To Get Dataverse List Rows Count Using Power Automate
Display Dataverse Choices in Power Apps
Following that, we’ll discuss how to display Dataverse choice values in a Power Apps input control, precisely a Power Apps Dropdown control.
Power Apps ComboBox control is an alternative to Power Apps Dropdown control.
- Before we can add the options to the Power Apps Dropdown, we first need to connect the Dataverse table connector to the app. so that we may access each column in that specific dataverse table.
- Select the Dataverse table under the Tables section, or navigate to the Data tab (from the left menu) -> Expand + Add data -> Search for the Dataverse table name (Book Purchase Infos) and select it. The particular Dataverse table has now been included in the app.
- Add a Power Apps Dropdown control after that, then run the following command on the Items property:
Items = Choices('Book Status')
Where,
‘Book Status‘ = Dataverse Choice column name
Refer to the screenshot below.
- Save, Publish, and Preview the app. When we click on Dropdown Chevron, then the Dataverse choice values (Delivered, Not Delivered, etc.) are displayed as in the sample below.
This is how to display Dataverse Choices in the Power Apps Dropdown Control.
Check Post: How to get data from Dataverse in Power Apps
Power Apps Patch Choice Field Dataverse
In the next topic, we will see how to patch Dataverse Choice Field in Power Apps.
- The screenshot below shows a Book Purchase Details form with multiple Power Apps input controls and button control.
- As you can see, the Book Status Combobox control has Dataverse Choice values. I now wish to modify the Dataverse Choice value in the Dataverse table using Power Apps.
- Before pressing the Submit button, the user must complete all of the form’s fields, including the Dataverse choice field. Once the user clicks the Submit button as shown below, a new item will be produced in the specific dataverse table (Book Purchase Info).
To approach this, take a look at the things below.
- First, pick the Book Status Combobox control and set its Items property to:
Items = Choices('Book Status')
- Next, select the SUBMIT button and apply the code below on its OnSelect property as:
OnSelect = Patch(
'Book Purchase Infos',
Defaults('Book Purchase Infos'),
{Title: txtBookTitle.Text},
{'Book Price': Value(txtBookPrice.Text)},
{BookSellerId: txtBookSellerID.Text},
{'Purchase Date': dtPurchaseDate.SelectedDate},
{'Book Status': cmbBookStatus.Selected.Value}
)
Where,
- txtBookTitle = Text input control name for the book title.
- txtBookPrice = Text input control name for the book price. As this is a Currency type field, so to patch the currency value, we need to use the Power Apps Value function.
- txtBookSellerID = Text input control name for the bookseller ID.
- dtPurchaseDate = Date picker control name for the book purchase date.
- cmbBookStatus = Combo box control name for the book status.
- Save, Publish, and Preview the app at this time. Fill out the form completely, then press the SUBMIT button.
- Return to the Dataverse table (Book Purchase Info) and refresh it after that. The Dataverse table has a new item that has been created, as shown in the image below.
In this way, we can Patch the Dataverse Choice Field in Power Apps.
Read: How to Export Dataverse Table to Excel
Power Apps Filter Dataverse Choice Column
Would you be interested in filtering the Power Apps dataverse choice column? To do this, follow the directions below.
- A Power Apps Dropdown control and a Data table control are seen in the screenshot below. The data table filters and only shows the user-selected status records when the user chooses any status from the dropdown control.
- As an example, I wanted to see all the books that have previously been delivered here. I have chosen Delivered as the Book Status for this. Following that, the data table applied filters to the records and displayed all of the delivered books, as seen below.
- To work around this, select the Dropdown control and set its Items property as:
Items = Choices('Book Status')
Where,
‘Book Status‘ = Name of the Dataverse Choice Column
- Next, insert a Data table control and apply the code below on its Items property as:
Items = Filter(
'Book Purchase Infos',
IsBlank(ddSelectStatus.Selected.Value) || 'Book Status' = ddSelectStatus.Selected.Value
)
Where,
ddSelectStatus = Dropdown control name
According to the code above, if the dropdown control is empty, the data table does not filter and returns all the records; otherwise, the data table filters based on the user-selected dropdown value.
NOTE:
The above code will not work if you have chosen the Selecting multiple choices is allowed option in the Dataverse Choice Column. An incompatible error will appear where it doesnot allow the optionset value.
This is how to filter Dataverse Choice Column in Power Apps Datatable.
To read more details about Dataverse Choice filter, refer to this complete post: Filter Dataverse Choice Column [With Various Examples]
Filter Dataverse Choice Column by a Specific Value
Suppose in Power Apps, you want to filter the dataverse choice column by a specific value. In this case, you can follow the instructions and code below.
Imagine I want to show every record in the Power Apps gallery that hasn’t yet been delivered as below.
- To achieve this, select the gallery control and apply the code below on its Items property as:
Items = Filter(
'Book Purchase Infos',
'Book Status' = [@'Book Status'].'Not Delivered'
)
Where,
‘Not Delivered‘ = Specify one of the choice values from the Dataverse Choice Column
This is how to filter the Dataverse Choice Column by a specific value in Power Apps.
Also Check: Power Apps Add Data to Dataverse Table
Power Apps Sort Dataverse Choice Column
Do you want to sort the Dataverse Choice Column in Power Apps? Refer to the scenario below to achieve it.
The Power Apps Dropdown control that has the Dataverse Choice Values is shown in the screenshot below. Ascending values for all Dataverse choice values are now visible (in the 2nd image). Let’s look at our options for doing this.
- To work around this, select the Dropdown control and set its Items property as:
Items = Sort(
Choices('Book Status'),
Text(Value)
)
Where,
‘Book Status‘ = Dataverse Choice field name
The dropdown control’s options are always ordered in ascending order whenever the above code is being used.
Power Apps Sort Dataverse Choice Column in Descending Order
Next, we will see how to sort the Dataverse Choice Column in descending order.
To sort the Dataverse choices, select the Dropdown control and set its Items property to the code below:
Items = Sort(
Choices('Book Status'),
Text(Value),
Descending
)
Where,
Descending = Specify the order that you want to view in the Dropdown control
This is how to Sort the Dataverse Choice Column in Power Apps Dropdown control.
Furthermore, you may like some more Dataverse tutorials:
- How to create and use dataflow in Dataverse
- Dataverse Version History
- How To Remove Commas From Dataverse Number Field
- Power Apps Different Home Screen Based On Different User
- Dataverse Solution [Complete Tutorial]
- How to Create Dataverse File Field
- How to Create Dataverse View
- How to Upload images to Dataverse from Power Apps
- Dataverse Primary Name Column Autonumber
- Delete All Records From Dataverse Table [With Examples]
This Dataverse tutorial clarified the definition of a Dataverse Choice field, how to add a Choice column to a Dataverse table, as well as several uses for it. We also discussed the following detailed topics:
- What is Power Apps Dataverse Choice?
- Dataverse Choice vs Choices
- Dataverse Choice Vs Lookup
- Create Dataverse Choice Column
- Display Dataverse Choices in Power Apps
- Power Apps Patch Choice Field Dataverse
- Power Apps Filter Dataverse Choice Column
- Filter Dataverse Choice Column by a Specific Value
- Power Apps Sort Dataverse Choice Column
- Power Apps Sort Dataverse Choice Column in Descending Order
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com