cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Search and SortByColumn problem

Hi, I'm trying to do a search and SortByColumn in the gallery item property but I'm getting errors. Here's the current code inside the item property: 

sort.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Search and SortByColumn problem

Hi @Neil82 ,

I am after the SortByColumns code - if we are going to work with it, it needs to be exact. I OCRd the previous post from your picture.

Also you will need to create a new column and delete the old one as SharePoint retains the original column name.

Your Collect code on Treasury will pick up all the fields, so that is OK. We just need the correct syntax and references on the Sort code. Before you do that, create another date column and see if the error goes away sorting on that one.

View solution in original post

11 REPLIES 11
Highlighted
Community Champion
Community Champion

Re: Search and SortByColumn problem

Hi @Neil82 ,

Apart from Date being a bad name for a field (it is a reserved word), do you have a control called SortDescending1?

SortByColumns(
   Search(
      colActiveApplication,
      Textlnputl.Text,
      "Title", 
      "Name", 
      "Loan_x0020_Type", 
      "Status", 
      "Resolution", 
      "Assigned_x0020_To"
   ), 
   "Date",
   If(
      SortDescending1, 
      Descending,
      Ascending
   )
)

 Also are all the other field names valid in the Collection?

 

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
Helper II
Helper II

Re: Search and SortByColumn problem

This is what's inside my Sort icon OnSelect propert : "UpdateContext({SortDescending1: !SortDescending1})"

 

Yes, I have used the search and it has worked, just that with the SortByColumn added, it doesnt.

Highlighted
Community Champion
Community Champion

Re: Search and SortByColumn problem

Hi @Neil82 ,

The error in your code posted is under the Sort criteria.SortError.png

Just to test my theory, try this - also confirm you have a column on colActiveApplication called Date

SortByColumns(
   Search(
      colActiveApplication,
      Textlnputl.Text,
      "Title", 
      "Name", 
      "Loan_x0020_Type", 
      "Status", 
      "Resolution", 
      "Assigned_x0020_To"
   ), 
   "Date",
   Ascending
)

 

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
Helper II
Helper II

Re: Search and SortByColumn problem

Tried it, getting this error:

 fgdddfdffdfd.png

This is how I made my collection, I was assuming the column "Date" would be included in the "colActiveApplication?"
collect.png

Highlighted
Community Champion
Community Champion

Re: Search and SortByColumn problem

Thanks @Neil82 ,

So we can work on it, can you please post your code as Text - change column names if you have to, but all I did was remove the reference to the Sort control, so it should not have caused additional errors.

Also do you have a field called Date in the Treasury List?

Highlighted
Helper II
Helper II

Re: Search and SortByColumn problem

This is what's inside my OnStart property for the App:
ClearCollect(colActiveApplication,Filter(Treasury, Status = "In Progress"));
ClearCollect(colCompleted,Filter(Treasury, Status = "Done"));
ClearCollect(colMenu, {ID: 1,Title: "Assigned To Me"},{ID: 2,Title: "All"},{ID:3, Title: "Completed"});
ClearCollect(colTreasuryTeam, {Name: "Korone"},{Name: "Subaru"},{Name: "Rushia"});
ClearCollect(colStatus, {Name: "In Progress"},{Name: "Done"});
ClearCollect(colResolution, {Name: "Released"},{Name: "Treasury Approval"});

 

I will try to change the "Date" column into another name, also is the above code what you're asking for?

Highlighted
Community Champion
Community Champion

Re: Search and SortByColumn problem

Hi @Neil82 ,

I am after the SortByColumns code - if we are going to work with it, it needs to be exact. I OCRd the previous post from your picture.

Also you will need to create a new column and delete the old one as SharePoint retains the original column name.

Your Collect code on Treasury will pick up all the fields, so that is OK. We just need the correct syntax and references on the Sort code. Before you do that, create another date column and see if the error goes away sorting on that one.

View solution in original post

Highlighted
Helper II
Helper II

Re: Search and SortByColumn problem

I've deleted the "Date" column and made a new one "Date Submitted." It seems that the error is gone now but when I click on the sort icon, it does not do anything.

SortByColumns(
Search(colActiveApplication,TextInput1.Text,"Title", "Name", "Loan_x0020_Type", "Status", "Resolution", "Assigned_x0020_To"), "Date_x0020_Submitted", If(SortDescending1, Descending, Ascending))

Highlighted
Community Champion
Community Champion

Re: Search and SortByColumn problem

@Neil82 ,

I assume you have a heap of dates to sort in the new 'Date Submitted' column ? There is nothing wrong with your code.

SortByColumns(
   Search(
      colActiveApplication,
      TextInput1.Text,
      "Title", 
      "Name", 
      "Loan_x0020_Type", 
      "Status", 
      "Resolution", 
      "Assigned_x0020_To"
   ),
   "Date_x0020_Submitted", 
   If(
      SortDescending1, 
      Descending, 
      Ascending
   )
)

 

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.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,181)