cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

"SortOrder.Descending" syntax error in my formula

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

@mckent1 ,

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.

 

View solution in original post

6 REPLIES 6
Highlighted
Super User III
Super User III

Hi @mckent1 ,

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.

Highlighted

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})

Highlighted

@mckent1 ,

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?

Highlighted

@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

Highlighted

@mckent1 ,

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.

 

View solution in original post

Highlighted

@WarrenBelz  thanks a lot ! It works... 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (5,388)