Power Apps Choices Function with Examples

In this PowerApps tutorial, We will discuss what is the choices function in Power Apps, its syntax, and how the PowerApps user can use the PowerApps choices function in many different ways.

Also, We will cover these below topics that are related to PowerApps Choices function as:

  • Power Apps choices function
  • Power Apps choices filter
  • PowerApps choices from sharepoint list
  • Power Apps dropdown choices from collection
  • PowerApps display choice field in gallery
  • Power Apps choices collection
  • Power Apps choices add
  • PowerApps hide choices
  • Power Apps choice checkbox
  • PowerApps choices manual
  • Power Apps choice field blank value
  • PowerApps choices dropdown
  • Power Apps choices combobox
  • PowerApps choices default value
  • Power Apps choices searchtext
  • PowerApps choices error
  • Power Apps count choices
  • PowerApps choices empty
  • Power Apps choices more than 20 items
  • PowerApps choices order
  • Power Apps choices patch
  • PowerApps patch choice column sharepoint
  • Power Apps reset choices
  • PowerApps remove choices
  • PowerApps sortbycolumns choices
  • Power Apps SortByColumns Function Syntax

PowerApps choices function

  • Power Apps Choices Function helps to return a table of the possible values for a lookup column.
  • You can use this Choice function in the PowerApps Combo Box control, Dropdown control, ListBox control, etc.
  • You can use Filter, Sort, AddColumns, and all other functions to the Choice function because it returns a table.
  • Choices don’t require column names to be strings and enclosed in double quotes (” “).
  • You can use lookup columns only with SharePoint and Microsoft Dataverse.

Power Apps choices function Syntax

Below represents the syntax of PowerApps Choice function:

Choices( column-reference )

Where,

column-reference = This is required. A lookup column of a data source. Don’t enclose the column name in double-quotes. The reference must be direct to the column of the data source and not pass through a function or control.

Power Apps Choices Function
Power Apps Choices Function

Power Apps choices filter

Do you want to filter the SharePoint Choice column in Power Apps? To achieve this, refer to the below simple scenario.

  • There is a SharePoint List named Project Details. This list has one choice column named Project Status. The Choice field has these many below choice values as:
    • Submitted
    • Approved
    • Rejected
    • Pending
  • Now I would like to filter this choice field and display only the Approved values in the PowerApps Gallery control.
  • On the PowerApps screen, Insert a Gallery control and Connect to the SharePoint List Data source (Project Details).
  • Now, Select the Gallery control and apply this below formula on its Items property as:
Items = Filter(
    'Project Details',
    "Approved" in 'Project Status'.Value
)

Where,

  1. Project Details‘ = SharePoint List name
  2. “Approved” = Specify the choice value that you want to filter
  3. ‘Project Status’ = SharePoint Choice column
PowerApps choices filter
PowerApps choices filter
  • Save and Preview the app. You can see the gallery has been filtered and display only the Pending values as shown below.
Power Apps choices filter
Power Apps choices filter

Power Apps choices from sharepoint list

Here we will see how to work with PowerApps choices from the SharePoint list or SharePoint Choice column in PowerApps. To work with the SharePoint choices in the drop-down list, you can use the function as Choices. For example:

Choices([@'Products'].Vendor)

Where,

  • Products = SharePoint List Name
  • Vendor = SharePoint Choice column

Now we will see how we can use this code in the PowerApps screen. Follow these below steps.

  1. I have a SharePoint list named Products. This list has a Choice column named Vendor having different types of values as like the below screenshot.
PowerApps choices from sharepoint list

2. On the PowerApps screen, Insert a Drop down control and apply this above formula on its Items property:

Power Apps choices from sharepoint list
Power Apps choices from sharepoint list

NOTE:

Before applying this code, you need to make sure about the Datasource connection. That means you should connect to the SharePoint List Connection (As I am using the SharePoint List).

3. Save and Preview the app. Once you will click on the dropdown symbol (from dropdown control), then you can see all the choice values from the SharePoint list as shown below.

PowerApps choice values from sharepoint list
PowerApps choices from sharepoint list

You can refer to this below articles to learn more details about PowerApps Drop down control:

PowerApps dropdown choices from collection

In this scenario, We will see how we can work with the PowerApps dropdown choices from collection. Let’s do it in a simple way.

  1. As it is PowerApps dropdown choices from the collection, So at first we need to create a PowerApps Collection. Apply this below formula on Screen’s OnVisible property as:
OnVisible = ClearCollect(
    colProjSummary,
    {
        comments: "Good",
        project_detail: "Project1",
        project_type: "PowerApps",
        hours2: "10",
        id: 1,
        minutes: "20"
    },
    {
        comments: "Good",
        project_detail: "Project2",
        project_type: "PowerAutomate",
        hours2: "15",
        id: 1,
        minutes: "30"
    }
)

Where,

  • colProjSummary = PowerApps Collection name
  • comments, project_detail, project_type, and so on = These are the columns or headers that will appear in the specified Collection
  • “Good”, “Project1”, “PowerApps” and so on = These are the values that I specified for each column or header
PowerApps dropdown choices from collection
PowerApps dropdown choices from collection

2. Insert two Dropdown controls named Project Detail and Project Type. Select the Project Detail Dropdown control and set its Items property as:

Items = Distinct(
    colProjSummary,
    project_detail
)

Where,

  • Distinct = This is a PowerApps function that helps to remove the duplicates from a table or data source.
  • colProjSummary = Specified Collection name
  • project_detail = PowerApps Column/Header name
Power Apps dropdown choices from collection
PowerApps dropdown choices from collection example

3. In the same way, select the Project Type Dropdown control and set its Items property as:

Items = Distinct(
    colProjSummary,
    project_type
)

Where,

  • colProjSummary = Specified Collection name
  • project_type = PowerApps Column/Header name
PowerApps dropdown choice from collection
Power Apps dropdown choices from collection

4. Now Save and Publish the app. Reopen the app again. Once you will reopen it, you can see both the dropdown control will appear with the specified collection values as in the below screenshot. Also, you can change the value by selecting the dropdown arrows.

PowerApps dropdown choice from collections
Power Apps dropdown choices from collection example

Power Apps display choice field in gallery

Suppose you want to show a choice field in the PowerApps Gallery control. Let’s take a simple example that how you can display it in a simple way.

Example -1:

In this example, I want to display a SharePoint Choice column in the PowerApps Gallery control.

  • There is a SharePoint list named SharePoint Training Course. This list has a Choice column named Course Type having with these choice values as:
    • Microsoft Document
    • Microsoft Excel
    • PDF
    • PPT
PowerApps display choice field in gallery
  • All these above choice values I want to show in a PowerApps Gallery control. For this, Insert a Gallery control and set its Items property to the SharePoint List Data Source (SharePoint Training Course).
  • Now add a Label control in the Gallery and apply this below formula on its Text property as:
Text = ThisItem.'Course Type'.Value

Where,

‘Course Type’ = SharePoint Choice Column

Power Apps display choice field in gallery
PowerApps display choice field in gallery

Example – 2:

In this scenario I would like to display details from a gallery items on a PowerApps Label control.

  • On the PowerApps screen, there is Vertical Gallery control having its Items property with the SharePoint List Data source (‘SharePoint Training Course’).
  • This gallery control is having the Layout as “Title, Subtitle and body“. The layout represents the respective SharePoint columns as shown in the below screenshot.
Power Apps display choice field in gallery control
Power Apps display choice field in gallery
  • Now what I would like to do is, when a PowerApps user will select an item from the gallery, then the respective choice value will appear in a Label control.
  • To do this, Insert a Label control and apply this below formula on its Text property as:
Text =  Gallery2.Selected.'Course Type'.Value

Where,

  1. Gallery2 = Gallery control name
  2. ‘Course Type’ = SharePoint Choice column
PowerApps display choice field in a gallery
Power Apps display choice field in gallery control
  • Save and Preview the app. Select one item from the gallery control. Then you can see the specific course type of the respective item in the label control as shown above.

Example – 3:

Suppose you want to display the multiple choice column values in a gallery control. That means, whatever the choice values present in the list, all the values will display in a text label of gallery control.

  • To achieve this, We can use the PowerApps Concate function. Select the Text label of gallery control and apply this below code on its Text property as:
Text = Concat('SharePoint Training Course','Course Type'.Value,"; ")

Where,

  1. ‘SharePoint Training Course’ = SharePoint List name
  2. ‘Course Type’ = SharePoint Choice column
  3. “; “ = This is the separator that helps to separate the choice values
  • When you will Save and Preview the app, you can see all the choice values display in the gallery control as like the below screenshot.
PowerApps display choice field in gallery control
Power Apps display choice field in gallery control

PowerApps choices collection

Suppose you need to build PowerApps Collection from the SharePoint List Choice column, then this code structure will help you to achieve your needs.

ClearCollect(colChoices, Choices( yourListName.yourChoiceColumn))

Where,

  1. ClearCollect = This PowerApps function helps to delete all the records from a collection and adds a new set of records to the same collection
  2. colChoices = PowerApps Collection name
  • If you are interested to learn more about collection, then refer to these below article:
  1. Use PowerApps Collection
  2. PowerApps Collection: Add, Update, Remove and Filter items

PowerApps choices add

Do you want to add a new choice value to the PowerApps Dropdown control? Follow this below simple example.

  • There is a SharePoint list named Project Details. This list has one choice column named Project Status having with these below choice values as:
    • Submitted
    • Approved
    • Rejected
    • Pending
  • In the below screenshot, You can see there is a Dropdown control having choice values (from the existing SharePoint List). Next, I want to add one more choice-value (Draft) in this Dropdown control (without adding it to the SharePoint List).
powerapps add choices to collection
PowerApps choices add
  • Select Screen’s OnVisible property and apply this below code:
OnVisible = ClearCollect(
    colProjStatus,
    {Value: "Draft"}
);
Collect(
    colProjStatus,
    Choices('Project Details'.'Project Status')
)

Where,

  1. colProjStatus = PowerApps Collection name
  2. “Draft” = Specify the choice value that you want to add in the dropdown control
  3. ‘Project Details’ = SharePoint List name
  4. ‘Project Status’ = SharePoint Choice Column name
PowerApps add choices
PowerApps choices add values
  • Next, Select the Dropdown control and set its Items property to the created collection name:
Items = colProjStatus
powerapps add choices to dropdown
powerapps add choices to dropdown
  • Save, Publish and close the app. Again reopen the app and select the dropdown arrow, you can see the new choice-value (Draft) has been added to the dropdown control as shown in the below screenshot.
powerapps add choices to collection
powerapps add choices to dropdown

PowerApps hide choices or PowerApps remove choices

Here we will see how we can hide or remove one of the choice value from the dropdown control in PowerApps.

  • As you can see there is a PowerApps Dropdown control having the below choice values (from the SharePoint choice column).
  • Here what I would like to do is, I want to hide one choice i.e. APPLE from the dropdown control but not in the SharePoint list.
PowerApps hide choices
PowerApps hide choices
  • Select the Dropdown control and apply this below formula on its Items property as:
Items = Filter(
    Choices(Products.Vendor),
    Value <> "APPLE"
)

Where,

  1. Products = SharePoint List name
  2. Vendor = SharePoint Choice column
  3. “APPLE” = Specify the choice value that you want to hide from the dropdown control
Power Apps hide choices
Power Apps hide choices example
  • Save and Publish the app. Reopen the app again. When you will click on the dropdown arrow from the dropdown control, then you can see the specified choice-value has been hidden as shown in the below screenshot.
PowerApps hide choice
Power Apps hide choices

PowerApps choice checkbox

Do you want to work with PowerApps Choice Checkbox and how a user can use it properly, then you can refer to the below details guide:

PowerApps choices manual

Suppose you want to add a new choice value manually in the PowerApps Dropdown or Combobox control. Then follow these below steps to do so.

  • There is a Choice column (Vendor) in the SharePoint List named Products. This choice column has these many below choice values.
PowerApps choices manual
PowerApps Add choices manually
  • On the PowerApps screen, there is a PowerApps Edit form having this SharePoint list choice column (Vendor). Now let us assume a user wants to add a new value in the Dropdown control. That means the user can type any value in the dropdown control text box (apart from the dropdown choice values) and the specific value will store in the SharePoint list as well.
  • For this, you can apply this below-tested code on the Update property of the Dropdown control Data Card (Vendor) as:
Update = If(
    DataCardValue20.SearchText in Choices(Products.Vendor).Value,
    DataCardValue20.Selected,
    {Value: DataCardValue20.SearchText}
)

Where,

  1. DataCardValue20 = Vendor dropdown control
  2. Products = SharePoint List Name
  3. Vendor = SharePoint Choice column

You can refer to this below screenshot.

Enter choices manually to Power Apps dropdown
Enter choices manually to Power Apps dropdown
  • Next, Save and Preview the app. Enter all the fields, type some text in the Vendor dropdown control, and then submit the form using button control.
Enter choices manually to Power Apps dropdown control
Enter choices manually to Power Apps dropdown control
  • Go to the existing SharePoint List (Products) and refresh it. Now you can see the new item has been created with the provided manual choice value as like the below screenshot.
manual choice in Powerapps
PowerApps choices manual

PowerApps choice field blank value or Power Apps choices empty

In this topic, By taking some simple scenarios, We will discuss how to set Power Apps choice field blank value.

Example – 1:

In this example, I want to set the default choice-value only when the dropdown field is blank. This means when the user will leave the dropdown control with a blank value, then there will be a default value that will set in the SharePoint list.

  • There is a SharePoint list named SharePoint Training Course. This list has a choice column called Course Type having different choice values like PPT, PDF, etc.
  • On the PowerApps screen, I have an Edit form that contains the specific SharePoint list data source. Now I would like to set the default value of the choice dropdown control data card.
  • Select the Course Type Choice control Data card and apply this below formula on its Default property as:
Default = If(
    ThisItem.'Course Type'.Value = Blank(),
    {Value: "None"},
    ThisItem.'Course Type'
)

Where,

  1. ‘Course Type’ = SharePoint Choice column
  2. “None” = Specify the choice value that you want to set in the dropdown control

The above code specifies if the course type value is blank, then the default value will set to None. Once you will apply the cod, then the default None value will display in the Dropdown control.

PowerApps choice field blank value
PowerApps choice field blank value
  • Now Save and Publish the app. Reopen the app again. Enter these field values with None value and save the form as shown below.
Power Apps choice field blank value
PowerApps choice field blank value example
  • Go to the SharePoint list (SharePoint Training Course), you can see the new item has been added with the None value like the below screenshot.
PowerApps choice field blank values
PowerApps choice field blank value

Example – 2:

In this scenario, I want to add an empty selection or a blank value to the power apps Dropdown control. The user can also select a blank value from the dropdown control.

  • To do this, first you need to apply this below formula on App’s OnStart property as:
OnStart = ClearCollect(
    coldropdownVal,
    ""
);
Collect(
    coldropdownVal,
    Choices('Project Details'.'Project Status')
)

Where,

  1. coldropdownVal = PowerApps Collection name
  2. “” = This is the blank value that I have specified
  3. ‘Project Details’ = SharePoint List name
  4. ‘Project Status’ = SharePoint Choice column
choice field blank value in PowerApps
PowerApps choice field blank value
  • Next set this collection on the Dropdown control’s Items property as:
Items = coldropdownVal
choice field blank value in Power Apps
PowerApps choice field blank value example
  • Save and Publish the app. Reopen the app again. Once you will click on the dropdown control, then you can see a blank value has been added to the choices as shown below.
choice field blank values in PowerApps

You can read this below PowerApps article to know more details about the PowerApps Choice field:

PowerApps choices combobox

Have you any idea that how you can use the SharePoint Choice value in a PowerApps Combo box control? If no, then there is a simple tutorial that explains how we can use Power Apps choices in a combo box. You can refer to these below articles:

  1. PowerApps Combobox Control
  2. Create People Picker in PowerApps with Combo Box

PowerApps choices default value

Do you want to set the Default value of a PowerApps Choice field? Do not need to worry about that.

  • PowerApps provides a property to each input controls named Default. A PowerApps user can use this property to set the default value of a choice field.
  • Suppose, you have a new form and you want your single choice field display “Choice1” as the default value in that form.
  • As you know, to show the choice field, you can use a Combo box control or a Dropdown control.

Case – 1: (By using Combo box Control)

  • To set the default value of a Combo box control, you can apply this below code on its DefaultSelectedItems property as:
DefaultSelectedItems = {Value:"choice1"}

Where,

“choice1” = Specify the default choice value that you want to set in the Combo box control

Case – 2: (By using Drop Down Control)

  • Select the Dropdown control and set its Items property as:
Items = Choices(listname.choicefieldname)
  • Set the Default property of the Dropdown control as:
Default = "choice1"
  • Select the Data card and apply this below code on its Update property as:
Update = Dropdown1.Selected

Once you will save and preview the app, then the drop down will display choice1 as the default value instead of blank value.

PowerApps choices searchtext

Now we will see how to search the choices in a PowerApps Combo box control.

  • The below screenshot represents a PowerApps Edit form having with the Sharepoint List Data source (Project Details). In this form, there is a Choice field (Combo box control) named Project Status.
  • In the Combo box control, when a user will search the text related to the choice values, then the control will display that respective text.
  • To achieve this, We need to apply the below formula on Combo box’s (Project Status) Items property as:
Items = Filter(
    Choices('Project Details'.'Project Status'),
    DataCardValue14.SearchText in Value
)

Where,

  1. ‘Project Details’ = SharePoint List name
  2. ‘Project Status’ = SharePoint Choice column
  3. DataCardValue14 = Combo box control Data card

NOTE:

Here you must know that, In the Combobox control, you need to enable a property of the Combo box i.e. “Allow searching“. If you will enable this property, then it will allow to the user to search the text within the control.
PowerApps choices searchtext
PowerApps choices searchtext
  • Save and Publish the app. When you will search the text in the combo box control, it will show all the choices that are related to the specified typed text.
PowerApps choices search text
PowerApps choices searchtext example

PowerApps choices dropdown

You can refer these below PowerApps tutorials that how you can easily use the choice values in a Dropdown control. There are so many examples to understand better.

  1. PowerApps SharePoint Lookup Column + PowerApps Dropdown Example
  2. Show hide fields based on dropdown selection PowerApps (2 Examples)
  3. PowerApps Cascading Dropdown (Detailed tutorial)

PowerApps choices error

  • On the PowerApps screen, I have a PowerApps Form (all the feilds are retrieved from the SharePoint List Data Source).
  • Most of the cases what happens is, everytime when a user open the app after saving or publishing, some Data fields (including Choice field) are always showing Red errors as like the below screenshot.
PowerApps choices error
PowerApps choices error
  • However it can reslove by coping the formula and pasting the exact same thing back into the field. But it should not be.
  • To resolve this type of Choice error issue, you need to refresh the Data source instead of copy paste things.
  • To refresh the Data source, Go to View -> Data sources -> Click on the elipses () of data source you want to refresh -> Select Refresh as shown below. Once the data source will refresh, then the issue will resolve.
Power Apps choices error
PowerApps choices error

PowerApps count choices

In this scenario, We will discuss how to work the Power Apps count function with a SharePoint Choice column field. In the other scenario, We will see how to count names in a multiple selection people picker column.

Example – 1(Count function with SharePoint Choice column)

  • On the Powerapps app, there is a gallery control. This control is having a SharePoint list data source named Project Details.
  • The SharePoint list (Project Details) is having a Choice column with these below choice values:
  1. Submitted
  2. Approved
  3. Rejected
  4. Pending
PowerApps count choices
PowerApps count choices
  • Here I want to count the total number of only Approved value that has been contained in the Sharepoint list. Not only approved value but also you can count the total number of Submitted, Pending, and Rejected values.
  • Apply this below formula on Label’s Text property as:
Text = CountIf(
    'Project Details',
    'Project Status'.Value = "Approved"
)

Where,

  1. ‘Project Details’ = SharePoint list name
  2. ‘Project Status’.Value = This specifies the SharePoint Choice column name. As it is a choice field, so we need to put the “.Value
  3. “Approved” = Specify the choice value that you need to count
  • As I have a total of two numbers of Approved items, that’s why the result is showing as 2 in the label control as below.
PowerApps count choice
PowerApps count choices example

Example – 2(Count function with SharePoint People picker column)

  • The below screenshot represents the SharePoint list named Employee Info. This list has a Person or People picker column named Training Manager. Also, this list has some records.
PowerApps count choice values
How to count choices in PowerApps
  • There is an edit form in the PowerApps app and this form is having that specific SharePoint list data source (Employee Info).
  • Here I would like to count the total number of people i.e. selected by the user. To do so, I have applied this below formula on Label’s Text property as:
Text = "People selected: " & CountRows(DataCardValue7.SelectedItems)

Where,

  1. “People selected: “ = This is the text that will display in the label control
  2. DataCardValue7 = People picker data card name
PowerApps count choice value
PowerApps count choice values
  • Now Save and Preview the app. Once you will select any person(s) or user(s) from the people picker column, then you can see the result in the label control as shown in the below screensot.
Power Apps count choice values
Power Apps count choice values

PowerApps choices more than 20 items

Example – 1:

  • Suppose in your SharePoint list, there is a Choice field having 20 choices, less than 20 choices, or more than 20 choice values. In this example what I want to do is, I want to display the total number of SharePoint choice values in the PowerApps.
  • As you can see in the below screen, there is a total 9 number of choices in the choice field named Source.
PowerApps choices more than 20 items
  • Next, on the PowerApps screen, I have a dropdown control and its Items property as:
Items = Choices('Travel Details'.Source)

Where,

  1. ‘Travel Details’ = SharePoint List name
  2. Source = SharePoint Choice column
Power Apps choices more than 20 items
PowerApps choices more than 20 items
  • Insert a Button input and set its OnSelect property as:
OnSelect = ClearCollect(
    colChoices,
    Choices('Travel Details'.Source)
)

colChoices = PowerApps Collection name

PowerApps choices more than 20 item
PowerApps choices more than 20 items example
  • Now to count the total number of choices, add a Label input control and apply this below formula on its Text property as:
Text = "Total Number of Choice Values: " & CountRows(colChoices)
Power Apps choices more than 20 item
PowerApps choices more than 20 items
  • Save and Preview the app. You can see the total number of choice values in the label control as in the above screenshot.

Example – 2:

In this scenario I want to display all the SharePoint List items in a PowerApps Dropdown control.

  • The below screenshot represents a SharePoint List named Customer Care Report Details. As you can see there is a total 10 number of items present in the list.
  • I want to display all the items (only the Title column) in the PowerApps Dropdown control. So that when a user will click on the dropdown control, he/she can able to select any item from the dropdown control itself.
PowerApps choice more than 20 items
  • Select the Dropdown control and apply this formula on its Items property as:
Items = 'Customer Care Report Details'.Title

Where,

  1. ‘Customer Care Report Details’ =
  2. Title = SharePoint column name. Not only you can specify the Title column, but also you can use any SharePoint Column from the list.

NOTE:

If it is a single line of a text column, then you need to apply the above formula. But if it is a Choice column, then you need to apply this formula as Choices([@’SharePoint List Name’].SharePoint Choice Column name)
PowerApps choice more than 20 item
  • Once you will Save and Preview the app, you can see all the items in the Dropdown control as shown below.
Power Apps choice more than 20 items

PowerApps choices order

Many of the PowerApps users want that their PowerApps Choice values will display in an appropriate order (Ascending or Descending). So that it may look good to others while selecting the choice values from the control.

  • To keep the choice-value in proper order, PowerApps provides a function called Sort. This PowerApps Sort function helps to sort a table based upon the formula.
  • I a having a Dropdown control having some choice values. I want to sort these choice values in ascending order as shown below.
PowerApps choices order
PowerApps choices order
  • Select the Dropdown control and apply this below formula on its Items property as:
Items = Sort(Choices('Travel Details'.Source), Value, Ascending)

Where,

  1. ‘Travel Details’ = SharePoint List name
  2. Source = SharePoint Choice Column
PowerApps choice order
PowerApps choices order

This is how we can work with Power Apps choices order.

PowerApps choices patch or PowerApps patch choice column sharepoint

Do you want to patch or update the SharePoint Choice column using PowerApps? Refer to this below scenario.

  • The below screenshot represents a SharePoint List Project Details. This list has a Choice column named Project Status.
  • Here I would like to update the SharePoint Choice value of a particular record i.e. Sharepoint. As you can see the Project Status value of SharePoint is Rejected, I want to update the value to Pending by using the PowerApps Button input.
PowerApps choices patch
  • On the PowerApps screen, I have a Gallery control that is having the SharePoint List data source (Project Details). When I will select the item from the gallery and then click on the button, it will update to the specified value.
  • Also, I have a Button (Click to Update) control that helps to update the selected value once the user will press on it.
Power Apps choices patch
PowerApps patch choice column sharepoint
  • Select the Button control and apply this below code on its OnSelect property as:
OnSelect = Patch(
    'Project Details',
    First(
        Filter(
            'Project Details',
            ID = Gallery5.Selected.ID
        )
    ),
    {
        ProjectStatus: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
            Id: 24,
            Value: "Pending"
        }
    }
);

Where,

  1. ‘Project Details’ = SharePoint List name
  2. Gallery5 = Galery control name
  3. ProjectStatus = SharePoint Choice column name
  4. Id = Specify the Item ID that you want to update in the SharePoint List
  5. “Pending” = Specify the Choice Value that you want to update
PowerApps patch choice column sharepoint
PowerApps patch choice column sharepoint example
  • Now save and preview the app. Select the item from the gallery control and then click on the button. You can see the value has been updated in the gallery control and as well as in the SharePoint list (Go to the specific list and refresh it).
PowerApps patch choice column in sharepoint

Here we saw how to work with PowerApps patch choice column in sharepoint.

PowerApps reset choices

Here we will see how we can reset a Choice control or a dropdown control in PowerApps.

  • In some cases what happens is, the user selects any choice from the dropdown control and closes the app directly. When he/she reopens the app again, then the dropdown control still shows the same selected value that was chosen by the user previously.
  • To avoid this thing, We can use a PowerApps property named Reset. By using this property, you can reset any control that you want in the app.
  • There are three different ways to reset the Choice control in PowerApps. Follow these below scenarios.

Scenario – 1: (By using control’s Reset property)

  • At first, As I discussed that PowerApps provides a property to each PowerApps input control called Reset, So you can directly use this Reset property in your choice or Dropdown control.
  • Select the Dropdown control and set its Reset property to true like below:
PowerApps reset choices
  • This is the simplest way that user can do it easily by using Reset property.

Scenario – 2: (By using Screen’s OnVisible property)

Also, you can reset the choice or dropdown control by using the screen’s OnVisible property. Select the Screen’s OnVisible property and set this below code as:

OnVisible = Reset(Dropdown12)

Where,

  • Dropdown12 = Specify the dropdown control name
Power Apps reset choices

Save, Publish and Close the app. Reopen the app again. Once you will reopen, you can see the dropdown choice control value has been reset to its default value.

Scenario – 3: (By using PowerApps Context variable)

There is another way to reset the the choice control i.e. using PowerApps UpdateContext method.

  • As you can see in the below screenshot, there is a Dropdown control and a Button input. Here I want to reset the dropdown control choice-value by using the button control.
  • That means, When a user will click on the button, then the dropdown control will reset to its default value.
  • Select the Dropdown control and set its Reset property to a variable like below:
Reset = varReset

Where,

varReset = Specify a variable name

PowerApps reset choice
PowerApps reset choice
  • Insert a Button control and apply this below formula on its OnSelect property as:
OnSelect = UpdateContext({varReset: true});
UpdateContext({varReset: false})

Where,

varReset = Specified Variable Name

Power Apps reset choice
PowerApps reset choice example
  • Save and Publish the app. Reopen the app, select one choice from the dropdown control and click on the Reset button. Then you can see the dropdown value will reset and change to its default value.

PowerApps sortbycolumns choices

Here we will see how to work with Power Apps sortbycolumns choices.

  • As you know, the PowerApps Sort function helps to sort the data in ascending or descending order in your data source. Similarly, If you want to sort the data or value in a specific order (as per your choice), then in that case you can use the PowerApps SortByColumns function.

PowerApps SortByColumns Function Syntax

Below represents the syntax of PowerApps SortByColumns Function:

Syntax – 1:

SortByColumns( Table, ColumnName1 [, SortOrder1, ColumnName2, SortOrder2, ... ] )

Where,

  1. Table = Specify the Data source or table to sort
  2. ColumnName(s) = This is required. Specify the column names to sort on, as strings.
  3. SortOrder(s) = This is an Optional. SortOrder.Ascending or SortOrder.Descending. SortOrder.Ascending is the default. If multiple ColumnNames are supplied, all but the last column must include a SortOrder.

Syntax – 2:

SortByColumns( Table, ColumnName, SortOrderTable )

Where,

  1. Table = This is required. Specify the table name or data source name to sort.
  2. ColumnName = This is also required. Specify the column name to sort on, as strings.
  3. SortOrderTable = This is required. Specify the single-column table of values to sort by.

Example:

  • There is a SharePoint List named SharePoint Project Expenses. This list has one text column named Day. Also, this list has some records as shown in the below screenshot.
PowerApps sortbycolumns choices
  • Here, I want to sort this Day column (from the SharePoint list) in PowerApps using the SortByColumns function.
  • On the PowerApps screen, I have a Listbox control (Here I am taking a Listbox control, but instead of this you can use any other controls like Gallery, Dropdown List, List box, etc.) and I would like to sort and show the column inside the Listbox control.
  • To do so, Select the Listbox control and apply this below formula on its Items property as:
Items = SortByColumns(
    'SharePoint Project Expenses',
    "Day",
    [
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday",
        "Sunday",
        "Monday"
    ]
)

Where,

  1. SharePoint Project Expenses’ = SharePoint List Name
  2. “Day” = SharePoint List Column Name
PowerApps sortbycolumns choice
PowerApps sortbycolumns choices
  • Once you will save and preview the app, you can see the output in the Listbox control as shown in the above screenshot.

Also, you may like these below PowerApps Tutorials as:

In this PowerApps tutorial, we discussed the PowerApps choices function, its syntax, and how PowerApps users can use it in many different ways.

Also, We covered these below topics that are related to PowerApps Choices function as:

  • PowerApps choices function
  • PowerApps choices filter
  • PowerApps choices from sharepoint list
  • PowerApps dropdown choices from collection
  • PowerApps display choice field in gallery
  • PowerApps choices collection
  • PowerApps choices add
  • PowerApps hide choices
  • PowerApps choice checkbox
  • PowerApps choices manual
  • PowerApps choice field blank value
  • PowerApps choices dropdown
  • PowerApps choices combobox
  • PowerApps choices default value
  • PowerApps choices searchtext
  • PowerApps choices error
  • PowerApps count choices
  • PowerApps choices empty
  • PowerApps choices more than 20 items
  • PowerApps choices order
  • PowerApps choices patch
  • PowerApps patch choice column sharepoint
  • PowerApps reset choices
  • PowerApps remove choices
  • PowerApps sortbycolumns choices
  • PowerApps SortByColumns Function Syntax
>