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

How to sort items using 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 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

 

SortByColumns(
    Filter(
        'Petty Cash & GL Code',
   // here we are saying that the status variable must be "All",
   // which will then not filter any items, or else the status must match the variable
        (StatusResult = "All") || Status = StatusResult,
   // here we are saying, the textbox text is a blank or else it must
   // additionally filter the above by EmployeeName based on the Textbox Text
        SearchBox.Text = "" || StartsWith(
            'Name (Title)',
            SearchBox.Text
        ),
        Text(
            Created,
            "mm/dd/yyyy"
        ) = Text(
            Today(),
            "mm/dd/yyyy"
        ),
        SortDescending1
    ),
    "Title",
    If(
        SortDescending1,
        Descending,
        Ascending
    )
)

 

 

 ON select of a button:

 

UpdateContext({SortDescending1: !SortDescending1}) ; Set(AllStatus, 'Petty Cash & GL Code')

 

 

 Please see the image below for better explanation thanks

Tapesh_0-1599038238194.png

 

 

Thanks for you help in advance. 

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: How to sort items using date

@Tapesh 
It looks like you are sorting based on the Title column.  Does the Title column hold your date?  If not, replace it with the column that holds your date.

This section of your code is not delegation-friendly because you're using the TEXT function.

        Text(
            Created,
            "mm/dd/yyyy"
        ) = Text(
            Today(),
            "mm/dd/yyyy"
        )

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Responsive Resident
Responsive Resident

Re: How to sort items using date

Hi @mdevaney 

 

Yes, the Date column is the Date Function, which is a created column which is by default in the SharePoint list. 


Please have a look at the screenshot below.

 

Tapesh_0-1599481013416.png

 

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 (6,491)