Filter Dataverse Choice Column [With Various Examples]

Are you familiar with Power Apps Dataverse choice column filtering options? Don’t think twice. We will learn everything there is to know about Microsoft Dataverse in this tutorial, including what Power Apps Dataverse Choices are, how to connect the Dataverse to Power Apps, and much more.

Additionally, the following connected topics will be covered:

  • Display Dataverse Table Records in Power Apps Gallery
  • Filter gallery by dataverse choice column
  • Filter Choices in Power Apps
  • How to filter dataverse choice column in powerapps
  • Filter Dataverse Gallery with a Specific Choice
  • Filter Dataverse Choice using Power Apps Combo Box
  • Filter the Dataverse choice column by the text value
  • Filter the Dataverse Choice Column by Dropdown
  • How to get value of Choice field in Power Apps
  • Power Apps get value of Choice field Dataverse

Power Apps Dataverse Choices

Let’s get started with Power Apps Dataverse Choices and how we can use this in Power Apps.

The below screenshot represents a Dataverse Table with several columns called Job Seekers Registration List. When we will go to the Columns section, then we can see all types of fields that are available in the dataverse table.

Filter Dataverse Choice Column
Filter Dataverse Choice Column
  • Moreover, we can view there is a Dataverse Choice field called Gender. This gender field has four choice values: Male, Female, Transgender, and Others.

If you are new to Dataverse and do not know how to create a Choice field in a Dataverse table, then follow this link: Dataverse Create Choice Column

Filter gallery by dataverse choice column
Filter gallery by dataverse choice column

The Dataverse table resembles the below image and contains several records.

Filter PowerApps gallery by dataverse choice column
Filter PowerApps gallery by dataverse choice column

Let us start with how to filter dataverse choice column in Power Apps. Before that, we must connect the Dataverse table to Power Apps. See the sections below for details on connecting to the Dataverse and using Power Apps.

Also, Read: Dataverse Primary Name Column Autonumber

Connect Dataverse to Power Apps

Next thing we will see how to connect the Dataverse table to Power Apps.

  • First, Sign in to Power Apps. Go to + Create from the left navigation and then choose Blank app.
  • Next, click on the Create button under the Blank canvas app as shown below. Then provide a name to the app and choose the Format either Tablet or Mobile. Click on Create.
PowerApps dataverse choices
PowerApps dataverse choices
  • To connect the Dataverse table (Job Seeker Registration List), go to the Home tab -> Click on the Data section (from left navigation) -> Tap on Add data button -> Choose the specific Dataverse table under the Tables section. Now the dataverse table has been added to Power Apps.
Connect Dataverse to Power Apps
Connect Dataverse to Power Apps
  • Now go to the File tab and Save the app by providing the name (if you have not provided it before).
PowerApps filter dataverse choice column
PowerApps filter dataverse choice column

This is how to connect the Dataverse table to Power Apps.

Display Dataverse Table Records in Power Apps Gallery

Here, we will see how to display all the Dataverse table records in the Power Apps Gallery control.

  • On the Power Apps screen, Insert a Power Apps Gallery control and set its Items property to the Dataverse table name as:
Items = 'Job Seekers Registration Lists'

Where,

See also  Power Apps Dataverse Yes/No Field

Job Seekers Registration Lists‘ = Dataverse table name

You can provide the Layout, Font, Font Size, Background Color, and much more to the gallery as per your need.

Display Dataverse Records in Power Apps Gallery
Display Dataverse Records in Power Apps Gallery

This is the way to display Dataverse Table Records in the Power Apps Gallery control.

Also, check: Dataverse create table from SharePoint list

Filter Dataverse Gallery with a Specific Choice

Next, we will discuss how to filter the Dataverse Power Apps gallery with a particular choice value.

  • Here, we will retrieve all the Dataverse Records that should match with the type of gender Male only and display them in the gallery control.
  • To work around this, select the gallery control and set its Items property to the code below:
Items = Filter(
    'Job Seekers Registration Lists',
    Gender = 'Select Gender'.Male
)
  1. Job Seekers Registration Lists‘ = Provide Dataverse table name
  2. Gender = Specify the choice column name
  3. Select Gender‘ = It is the display name of the choice field where all the choice values are stored in the Dataverse table
  4. Male = Specify a choice value from the choice field that you want to filter

Refer to the screenshot below.

Filter Dataverse Records with a Specific Choice
Filter Dataverse Records with a Specific Choice

This is how to filter Dataverse Gallery with a Specific Choice value.

Filter Choices in Power Apps

To work with the Power Apps filter Choice column, you can refer to this complete Power Apps tutorial: PowerApps Gallery Control Filter Example

Filter Dataverse Choice using Power Apps Combo Box

Do you know how to filter the dataverse choice field using a Power Apps Combobox control? Check out the scenario below.

  • The screenshot below represents a Power Apps Combobox control and a Gallery control. When a user chooses a specific gender from the combo box, the gallery filters and only shows the records that match their selection.
  • For example, if I choose the gender as Female, then the gallery only shows information about items that are specific to the Female gender.
Filtering Dataverse Choice using PowerApps ComboBox
Filtering Dataverse Choice using PowerApps ComboBox
  • To achieve this, set the Combobox Items property to the code below:
Items = Distinct(
    'Job Seekers Registration Lists',
    Gender
)

Where,

Distinct = This is a Power Apps function that helps to retrieve only the unique values

Filter Dataverse Choice using Power Apps Combo Box
Filter Dataverse Choice using Power Apps Combo Box
  • Next, select the gallery control and set its Items property as:
Items = Filter(
    'Job Seekers Registration Lists',
    Gender = cbGender.Selected.Result
)

Where,

cbGender = Combo box control name

Filter Dataverse Choice column using Combo Box
Filter Dataverse Choice column using Combo Box

This is how to filter Dataverse Choice value using Power Apps Combo Box control.

Read: Delete All Records From Dataverse Table [With Examples]

Filter Dataverse Choice Column by the Text Value

Have you ever tried to use a text value to filter the dataverse choice field? Sometimes a user wants to filter the dataverse choice columns by the text of the choice values.

When we wish to filter an option column by a variable or other user input, it is a common business case scenario. However, it’s not fully simple to complete this task.

  • Let’s imagine, for example, that we wish to get all entries whose Gender matches the text value “Others.” Due to a mismatch in data types, it is impossible to filter a choice column by a text value, as one might assume.
  • You can refer to the screenshot below where the code is correct but it is not executing in the Power Apps Gallery control and not showing any proper result.
Filter Dataverse Choice Column by the Text Value
Filter Dataverse Choice Column by the Text Value
  • Similarly, a choice value cannot be matched based on a choice item that we return from a call to LookUp. Unfortunately, it utilizes syntax that is conceptually valid and that I would predict working.
  • In the image below, you can see, that whenever we are implementing the below code in the gallery’s Items property, this code is throwing an error as “Incompatible types for comparison. These types can’t be compared: OptionSetValue(Select Gender), Record.
Items = Filter('Job Seekers Registration Lists',Gender=LookUp(Choices('Job Seekers Registration Lists'.Gender),Text(Value)="Others"))

Where,

  1. ‘Job Seekers Registration Lists’ = Dataverse Table name
  2. Gender = Dataverse Choice Column name
  3. Others = One of the choice values from the Dataverse choice field that we want to filter out
Filter Dataverse Choice Column by the Text
Filter Dataverse Choice Column by the Text

Solution:

See also  Power Apps Trim | Power Apps Remove First Character from String

As an alternative solution, we will use a Power Apps hidden Dropdown control. This is based on the idea that while a call to LookUp cannot be used to filter a choice column, it can be used to filter by the selected item in a dropdown.

  • Let’s say we want to get records that match the gender type that a user types into the txtEnterGender text input control.
  • Insert a Power Apps Dropdown control and set its Items property to the code below:
Items = Filter(
    Choices('Job Seekers Registration Lists'.Gender),
    Text(Value) = txtEnterGender.Text
)

Where,

  1. ‘Job Seekers Registration Lists’ = Dataverse Table name
  2. Gender = Dataverse Choice Column name
  3. txtEnterGender = Text input control name
  4. Text(Value) = PowerApps Function name that helps to convert a Choice to Text. To know more about this function, refer to this complete tutorial: Power Apps Value Function
  • Once we applied the code to Dropdown, we need to set the Visible property to false or off. So that nobody can see this Dropdown control in the app.
Filtering Dataverse Choice Column by Text Value
Filtering Dataverse Choice Column by Text Value
  • Next, apply the code below on the gallery’s Items property:
Items = Filter(
    'Job Seekers Registration Lists',
    Gender = ddSelGender.Selected.Value
)

Where,

ddSelGender = Dropdown control name

How to filter Dataverse Choice Column by Text Value
How to filter Dataverse Choice Column by Text Value
  • Finally, save, publish, and preview the app. The user may now enter any gender type value at runtime into the text input control, and the gallery control will display entries that match as shown below.
filter Dataverse Choice Column by powerapps text input
filter Dataverse Choice Column by powerapps text input

This is how to filter the Dataverse Choice Column by the Text Value.

Check: How to Upload images to Dataverse from Power Apps

Filter the Dataverse Choice Column by Dropdown

Next comes how we can filter the Dataverse Choice field by a Power Apps Dropdown control.

  • As in the image below, you can see there is a Dropdown control and a Gallery control. When a user selects a Gender type (suppose Others), the gallery filters and displays item information specific to the user’s selected gender (Others).
Filter Dataverse Choice by Dropdown
Filter Dataverse Choice by Dropdown
  • To work with this, set the code below on Dropdown’s Items property as:
Items = Choices('Job Seekers Registration Lists'.Gender)

Where,

Choices = This Power Apps function helps to return a table of the possible values for a lookup column.

Filter the Dataverse Choice Column by Dropdown
Filter the Dataverse Choice Column by Dropdown
  • Next, set the Gallery’s Items property to the below formula:
Items = Filter(
    'Job Seekers Registration Lists',
    Gender = ddGender.Selected.Value
)

Where,

ddGender = Dropdown control name

dataverse choice column by dropdown control
dataverse choice column by dropdown control

This is how to filter the Dataverse Choice Column by Dropdown control.

Power Apps get value of Choice field

Do you know what does mean for Power Apps get value of Choice field? Check out the simple example below.

  • In Power Apps, there is a Dropdown control and a Data table control. The data table filters and shows just those user-selected record information when a user chooses a certain option value from the dropdown menu.
  • Consider the following scenario: If we chose the Others option from the dropdown menu, the data table will only display entries that are of the Others gender.
Power Apps get value of Choice field
Power Apps get value of Choice field
  • Select the Dropdown control and set its Items property as:
Items = Choices('Job Seekers Registration Lists'.Gender)
powerapps get value of choice field dataverse
powerapps get value of choice field dataverse
  • Then, select the Data table and apply the formula below on its Items property:
Items = Filter(
    'Job Seekers Registration Lists',
    Gender = [@ddSelectGender].Selected.Value
)

Where,

See also  Power Apps Dataverse Choices [Complete Guide]

ddSelectGender = Name of the Dropdown control

Power Apps get value of choice field dataverse
Power Apps get value of choice field dataverse

This is how to work with Power Apps get value of Choice field.

Check out: PowerApps toggle control + How to use with examples

Power Apps get value of Choice field Dataverse

This topic explains how to work with Power Apps to get the value of the Choice field Dataverse.

  • A Power Apps dropdown control and a text input control are seen in the screenshot below. The dropdown control contains all the Dataverse Choice values: Male, Female, Others, and Transgender.
  • Whenever a user will select the Dataverse choice value as Male and Female from the Dropdown menu, then the text input control will display a message like “Registration Successful”.
  • Similarly, when a user will select the Dataverse choice value as Others and Transgender from the Dropdown menu, then the text input control will display a message like “Registration Unsuccessful“.
Get value of Choice field Dataverse
Get value of Choice field Dataverse
  • To achieve this, set the Items property of the Dropdown control as:
Items = Choices('Job Seekers Registration Lists'.Gender)

Where,

Gender = Dataverse Choice Column Name

Dataverse get value of Choice field
Dataverse get value of Choice field
  • Next, Select the Text input control and apply the code below on its Default property as:
Default = If(
    ddChooseGender.Selected.Value = 'Select Gender'.Male,
    "Registration Successful",
    If(
        ddChooseGender.Selected.Value = 'Select Gender'.Female,
        "Registration Successful",
        If(
            ddChooseGender.Selected.Value = 'Select Gender'.Transgender,
            "Registration Unsuccessful",
            If(
                ddChooseGender.Selected.Value = 'Select Gender'.Others,
                "Registration Unsuccessful"
            )
        )
    )
)

Where,

  1. ddChooseGender = Name of the Dropdown control
  2. ‘Select Gender’ = It is the display name of the choice field where all the choice values are stored in the Dataverse table
  3. Male, Female, Transgender, Others = These are the choice values that stored in the Select Gender field
  4. Registration Successful“, “Registration Unsuccessful” = Messages that display in the text input control based on the condition
Dataverse get value of Choice field in Powerapps gallery
Dataverse get value of Choice field in Powerapps gallery

To learn more about the Power Apps Choices function, read this complete tutorial: Power Apps Choices Function with Examples

This is how to work with Power Apps get value of Choice field Dataverse.

Also, you may like some more Dataverse and Power Apps Tutorials:

This Microsoft Dataverse Tutorial illustrated what is Power Apps Dataverse Choices and how to work the dataverse Choice field in Power Apps. Also, we covered all these below-related topics:

  • PowerApps dataverse choices
    • Connect Dataverse to PowerApps
    • Display Dataverse Table Records in Power Apps Gallery
  • Filter gallery by dataverse choice column
  • how to filter dataverse choice column in powerapps
  • Filter Dataverse Gallery with a Specific Choice
  • Working with Filter Dataverse Choice using Power Apps Combo Box
  • Filter Dataverse choice column by the text value
  • Working with Filter the Dataverse Choice Column by Dropdown
  • How to get value of Choice field in Power Apps
  • Power Apps get value of Choice field Dataverse
>