How to Sort Power Apps Radio Button?

Have you ever sorted Power Apps Radio button values? If not, no need to worry!

Follow this Power Apps tutorial; you will learn how to sort Power Apps Radio button. Like:

  • How to Sort Power Apps Radio Button Alphabetically (A-Z & Z-A)
  • Sort Power Apps Collection Field in the Radio Button
  • How to Sort SharePoint List Filed in the Power Apps Radio Button

How to Sort Power Apps Radio Button Alphabetically

Here, we will discuss how to sort the Power Apps Radio button items alphabetically. Such as:

  • Sort Power Apps Radio Button Items Ascending
  • Sort Power Apps Radio Button Items Descending

Sort Power Apps Radio Button Items Ascending

For example, I have created a Power Apps Canvas app and then added a Radio button control that contains the “Employee Names” [Which I added manually] as shown below.

How to Sort Power Apps Radio Button

Next, I want to arrange these Radio button values in ascending order [A to Z], as in the screenshot below.

How to Sort Power Apps Radio Button Control

To work around this, follow the below steps.

1. Create Power Apps app -> Insert the Radio button control on the screen -> Set its Items property as:

Items = Sort(
    [
        "Aiden",
        "Anthony",
        "Emma",
        "Emily",
        "Lily",
        "Blair",
        "Liar"
    ],
    Value,
    SortOrder.Ascending
)

Where,

  • Sort() = This Power Apps Sort() function helps us to sort the table depending on the formula
  • “Aiden”, “Anthony”, “Emma”, etc… = Power Apps Radio Button Items
How to Sort a Power Apps Radio Button

2. Save, Publish, and Preview the app. The Power Apps Radio box will display the records based on the ascending order, as shown below.

Sort Power Apps Radio Button Alphabetically

This is how to sort a Power Apps Radio button ascending.

Sort Power Apps Radio Button Items Descending

Similarly, we will see how to sort the Power Apps Radio button items descending [Z to A].

Example:

1. Here, I will also take the above Power Apps Radio button values for this example.

2. On the Power Apps Screen -> Select the respective Radio button and change its Items Property to the code below.

Items = Sort(
    [
        "Aiden",
        "Anthony",
        "Emma",
        "Emily",
        "Lily",
        "Blair",
        "Liar"
    ],
    Value,
    SortOrder.Descending
)
sort power apps radio button

3. Save, Publish, and Preview the app. The Power Apps Radio box will display the records in descending order like below.

sort power apps radio button values

This is all about how to sort the Power Apps Radio button Alphabetically.

Sort Power Apps Collection Field in Radio Button

We will learn how to sort a Power Apps Collection field in the Radio button.

Example:

1. I manually created a Power Apps collection, i.e., [colEventRegistration]. This collection contains the below Headers/Columns with respective records.

  • Name
  • Company Name
  • Gender
  • Age
Sort Power Apps Collection in Radio Button

2. In Power Apps, I have a Radio button control, and I want to sort and display the specific collection column [Company Names] in ascending order.

Refer to the below image:

Sort Power Apps Collection in a Radio Button

To do so, follow the below steps. Such as:

3. To create a Power Apps Collection, go to App’s OnStart property and write the code below:

OnStart = ClearCollect(
    colEventRegistration,
    {
        Name: "John Smith",
        CompanyName: "Buckeyee Furniture",
        Occupation: "Training and development specialist",
        Age: 34,
        Gender: "Female"
    },
    {
        Name: "Emma Reyna",
        CompanyName: "Fox valley CPAs",
        Occupation: "Accountant",
        Age: 32,
        Gender: "Female"
    },
    {
        Name: "Kelven",
        CompanyName: "Bugle Boy",
        Occupation: "Daimond Tracker",
        Age: 44,
        Gender: "Male"
    },
    {
        Name: "Lynee",
        CompanyName: "Specific Appraisals",
        Occupation: "Computer and Information Researcher",
        Age: 40,
        Gender: "Male",
        PhoneNumber: 5360875
    },
    {
        Name: "Steve Mroz",
        CompanyName: "Maxigraphics",
        Occupation: "Graphic Designer",
        Age: 39,
        Gender: "Male"
    },
    {
        Name: "Henrita Mullar",
        CompanyName: "Happy Harry's",
        Occupation: "Customer Suppot Executive",
        Age: 36,
        Gender: "Female"
    }
)

Where,

  • colEventRegistration = Power Apps Collection Name
  • Name, CompanyName, Occupation, Age, Gender = Collection Headers/Columns
  • “John Smith”, “Buckeyee Furniture”, etc… = Collection Records/Rows
Sort Power Apps Collection Field in Radio Button

4. Then, click on the Run OnStart under the App object to get the collection.

Sort Power Apps Collection Field in Radio Button Control

5. Now, insert a Radio button control and set its Items property as:

Items = SortByColumns(
    colEventRegistration,                                    
    "CompanyName",SortOrder.Ascending     //For Ascending Order
)                                        

SortByColumns(
    colEventRegistration,
    "CompanyName",SortOrder.Descending   //For Descending Order
)

Where,

  • colEventRegistration = Power Apps Collection Name
  • “CompanyName” = Collection Header Name
Sort Power Apps Collection in a Radio Button Control

5. Save, Publish, and Preview the app. The Power Apps Radio button will sort and display the collection field in ascending order as in the image below.

How to Sort Power Apps Collection in Radio Button

This is how we can sort a Power Apps collection in the Radio button control.

Sort SharePoint List Filed in Power Apps Radio Button

Last, we will discuss how to sort a SharePoint list field in the Power Apps Radio button with a simple scenario.

Scenario:

I have a SharePoint Online list named “Diseases List”. This list contains the below fields.

Column NameData Type
DiseaseIt is a single line of text, I just renamed it as “Disease”
Doctor’s NameA single line of text
Doctor’s FeesCurrency
Sort SharePoint List Filed in Power Apps Radio Button

In Power Apps, there is a Radio button and a Sort icon. Whenever a user can sort the records either in ascending or descending order based on the only title column [Disease], the Radio button will display the sorted records.

Refer to the below screenshot:

Sort SharePoint List Filed in Power Apps Radio Button Control

To achieve it, follow the below steps:

1. On the Power Apps Screen -> Insert a Sort icon and set its OnSelect property as:

OnSelect = Set(
    varColumn,
    "Title"
);
Set(
    varOrder,
    If(
        varOrder = SortOrder.Ascending,
        SortOrder.Descending,
        SortOrder.Ascending
    )
)

Where,

  • varColumn = 1st Global Variable Name
  • “Title” = SharePoint Title Field
  • varOrder = 2nd Global Variable Name
  • SortOrder.Descending, SortOrder.Ascending = Sort order can be either ascending or descending
How to Sort SharePoint List Filed in Power Apps Radio Button

2. Then, insert a Radio button control and set its Items property to the code below.

Items = SortByColumns(
    'Diseases List',
    varColumn,
    varOrder
)

Where,

  • colVacations = Power Apps Collection
  • varColumn, varOrder = Power Apps Global Variables
Sort SharePoint List Filed Values in Power Apps Radio Button

3. Once your app is ready, just Save, Publish, and Preview the app. The Power Apps Radio button displays sorted records based on the selecting sort icon [Either ascending or descending] as shown below.

Sort SharePoint List Filed Values in Power Apps Radio Button Control

This is how to sort a SharePoint list field values in the Power Apps Radio button Control.

Conclusion

I trust this Microsoft Power Apps tutorial taught all the information about how to sort a Power Apps Radio button. Here, we discussed how to sort the Power Apps Radio button alphabetically [A to Z & Z to A] and Sort the Power Apps collection field in the Radio button. Last, we covered how to sort a SharePoint list field values in the Power Apps Radio button.

You may also like: