cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Responsive Resident
Responsive Resident

Sort Items based on Date

Hi 

Experts im trying to sort the items based on name if entered and when they select the sortDecending1 button the items should sort based in the recent date order.  i.e from new to old and when deselected the sort button gallery items so be normal as old to new.

 

I do not know if im doing it correctly or not the below code is correct or not. Can anyone help me, please? if m doing wrong and what part im doing ...

 

Thanks, experts

ON Items property of Gallery:   also with the below formula im getting the delegation warning

 

Tapesh_0-1599644372555.png

When I used the above formula or code 

 

Im getting an error. as below  

Tapesh_0-1599645109881.png

 

 
 

 

 

Please see: I have converted date time to different formate using 

ON text property :

 

 

Text(ThisItem.Created, "[$-en-US]d, mmmm yyyy")

 

 

 

Whereas initial it was just simple Datetime Formate 

Tapesh_0-1599481013416.png

However, the error does remain the same. I.e. unable to sort items on date order ascending or descending.

 

 

Any help Experts Thanks. 

Has to raise this query again as I did not get any feedback on my last one. 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Sort Items based on Date

@Tapesh 

I'm not completely sure of your formula as you mention sorting by date, but it appears to be sorting by title.

If you want to sort by the Created date, then you can consider using this formula:

SortByColumns(
    Filter(
        'Petty Cash & GL Code' ,
        (StatusResult = "All" || Status = StatusResult) &&
        (SearchBox.Text = "" || StartsWith('Name (Title)', SearchBox.Text))
    ),
    "Created",
    If(SortDescending1, Descending, Ascending)
)    

 

This should give you results sorted by Created date.

 

Also, for future reference, if you want to sort by the Text version of a date, you should have your date in a yyyymmdd format.  Otherwise your sorting will be incorrect.

 

I hope this is helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

1 REPLY 1
Highlighted
Super User III
Super User III

Re: Sort Items based on Date

@Tapesh 

I'm not completely sure of your formula as you mention sorting by date, but it appears to be sorting by title.

If you want to sort by the Created date, then you can consider using this formula:

SortByColumns(
    Filter(
        'Petty Cash & GL Code' ,
        (StatusResult = "All" || Status = StatusResult) &&
        (SearchBox.Text = "" || StartsWith('Name (Title)', SearchBox.Text))
    ),
    "Created",
    If(SortDescending1, Descending, Ascending)
)    

 

This should give you results sorted by Created date.

 

Also, for future reference, if you want to sort by the Text version of a date, you should have your date in a yyyymmdd format.  Otherwise your sorting will be incorrect.

 

I hope this is helpful for you.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,639)