web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Dynamic parameters to ...
Power Apps
Unanswered

Dynamic parameters to SortByColumns function

(0) ShareShare
ReportReport
Posted on by 70

Hi

 

I'm building an app with a gallery that I wanted to sort by different columns at different times, but the Column argument of the function doesn't allow me to send dynamic parameters (like referencing the text of a label or a variable) without giving me data delegation issues. Is there any workaround for this?

FelipeFaccini_0-1679570470451.png

 

Categories:
I have the same question (0)
  • LuizVicente Profile Picture
    984 Super User 2024 Season 1 on at

    Any chance you could put the data in a collection?
    I made an example here, although not with collection, but it would work:

     

    Gallery.Items:

    With(
     {_data: Countries},
     If(
     IsBlank(gblSortBy),
     SortByColumns(
     _data,
     "Title",
     SortOrder.Ascending
     ),
     SortByColumns(
     _data,
     $"{gblSortBy}",
     SortOrder.Descending
     )
     )
    )

    Roverandom_0-1679623553232.png

     

    SortButton.OnSelect:

    Set(gblSortBy, TextInput1.Text)

     

    Roverandom_1-1679623590754.png

     

    sorting.gif

     

     

  • CantStopTheFlow Profile Picture
    21 on at

    Suppose that one needed to dynamically supply sort column names, like Country, State, and City. What would the With function look like if the user could supply any number of these values?

     

    So, be flexible enough to use each of these inputs:

    Country

    State

    City

    Country, State

    Country, City

    Country, State, City

    State, City

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard