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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / "SortOrder.Descending"...
Power Apps
Answered

"SortOrder.Descending" syntax error in my formula

(0) ShareShare
ReportReport
Posted on by

Hello,
I have some difficulties when I write this formula in my "Browse screen" screen, I would just like to use the SORTBYCOLUMNS function, with SORTORDER.DESCENDING. Because in fact I want my files to appear from the most recent to the oldest. But I can’t find the right writing syntax...
My current formula is:

 

************************************************************************************************

SortByColumns(Filter(MY SHAREPOINT LIST;Agence.Value = Dropdown2.SelectedText.Value; Or(
StartsWith(Commune;TextSearchBox1_1.Text);
StartsWith(Enquêteur;TextSearchBox1_1.Text);
StartsWith(Text(ID);TextSearchBox1_1.Text);
StartsWith(Text('Nom de la voie');TextSearchBox1_1.Text);
StartsWith(Text('Nom du demandeur du contrôle');TextSearchBox1_1.Text);
StartsWith('Code INSEE Commune'&"-"&(ID);TextSearchBox1_1.Text);
StartsWith('Numéro de voie';TextSearchBox1_1.Text)));"ID";
If(SortDescending1;Descending;Ascending))

************************************************************************************************

 

And i try this formula, but it doesn't work....

************************************************************************************************

SortByColumns(Filter(MY SHAREPOINT LIST;Agence.Value = Dropdown2.SelectedText.Value; Or(
StartsWith(Commune;TextSearchBox1_1.Text);
StartsWith(Enquêteur;TextSearchBox1_1.Text);
StartsWith(Text(ID);TextSearchBox1_1.Text);
StartsWith(Text('Nom de la voie');TextSearchBox1_1.Text);
StartsWith(Text('Nom du demandeur du contrôle');TextSearchBox1_1.Text);
StartsWith('Code INSEE Commune'&"-"&(ID);TextSearchBox1_1.Text);
StartsWith('Numéro de voie';TextSearchBox1_1.Text)));"ID";SortOrder.Descending;If(SortDescending1;Descending;Ascending))

************************************************************************************************

 

Have you any suggestions please ?

Thanks a lot

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @Anonymous ,

    You have two sort parameters - you only need one

    SortByColumns(
     Filter(
     MY SHAREPOINT LIST;
     Agence.Value = Dropdown2.SelectedText.Value &&
     (
     StartsWith(Commune;TextSearchBox1_1.Text) ||
     StartsWith(Enquêteur;TextSearchBox1_1.Text) ||
     StartsWith(Text(ID);TextSearchBox1_1.Text) ||
     StartsWith(Text('Nom de la voie');TextSearchBox1_1.Text) ||
     StartsWith(Text('Nom du demandeur du contrôle');TextSearchBox1_1.Text) ||
     StartsWith('Code INSEE Commune'&"-"&(ID);TextSearchBox1_1.Text) ||
     StartsWith('Numéro de voie';TextSearchBox1_1.Text)
     )
     );
     "ID";
     Descending
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    on at

    Thanks for your proposition,

    but if i write your formula,

    i don't have this text : 

    If(SortDescending1;Descending;Ascending))

     

    so the BUTTON "SortDescending1" like in the picture doesn't work.

    This is the ON SELECT formula for this button : 
    UpdateContext({SortDescending1: !SortDescending1})

  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    @Anonymous ,

    Yes, but your original code will sort by ID descending (which is what you asked for) when you push the button (and back ascending when you push it again).

    What exactly are you trying to achieve?

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz 

     

    Thank you for your answer,
    in fact, I wish that by default on the BROWSECREEN my files appear in a DESCENDING way, from the most recent to the oldest, but I also want that when we click on the button, we can still change the order in ASCENDING or DESCEDING and vice versa

  • Verified answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    @Anonymous ,

    Just reverse the logic on the button (although you might also want to rename the Variable to SortAscending to avoid confusion)

    SortByColumns(
     Filter(
     MY SHAREPOINT LIST;
     Agence.Value = Dropdown2.SelectedText.Value &&
     (
     StartsWith(Commune;TextSearchBox1_1.Text) ||
     StartsWith(Enquêteur;TextSearchBox1_1.Text) ||
     StartsWith(Text(ID);TextSearchBox1_1.Text) ||
     StartsWith(Text('Nom de la voie');TextSearchBox1_1.Text) ||
     StartsWith(Text('Nom du demandeur du contrôle');TextSearchBox1_1.Text) ||
     StartsWith('Code INSEE Commune'&"-"&(ID);TextSearchBox1_1.Text) ||
     StartsWith('Numéro de voie';TextSearchBox1_1.Text)
     )
     );
     "ID";
     If(
     SortDescending1;
     Ascending;
     Descending
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz  thanks a lot ! It works... 

  • sid95 Profile Picture
    2 on at

    SortByColumns('Floor Opening',OpeningNumber_Column1,SortOrder.Descending);

     

     

    i'm getting an error here, someone assist me please

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard