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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Searching for items in...
Power Apps
Answered

Searching for items in sharepoint using gallery

(0) ShareShare
ReportReport
Posted on by 210

Currently my sharepoint has about 3000 items being stored. I have a gallery that lets a user search for the item which would perfect. However, it shows the items from oldest - newest. it is possible to make to show the newest items to the oldest items instead?

 

My code looks like this so it allows users to search by a wide range of values. I am assuming I need type of sort? Not to sure though.

 

Filter(
 ReferralSystem,
 StartsWith(Title, TextInput1.Text)
 || 
 StartsWith(DateofReferralText, TextInput1.Text)
 ||
 StartsWith(PhoneNumber, TextInput1.Text)
 ||
 StartsWith(CustomerName, TextInput1.Text)
 ||
 StartsWith(ContactName, TextInput1.Text)
 ||
 StartsWith(BackupName, TextInput1.Text)
 ||
 StartsWith(ReferredBy, TextInput1.Text)
 ||
 StartsWith(AreaOfInterest, TextInput1.Text)
 ||
 StartsWith(Department, TextInput1.Text)
 ||
 StartsWith(ReferredToName, TextInput1.Text)
)

 

Categories:
  • dyee4614 Profile Picture
    283 on at

    I think you just need to do sortbycolumn, select the date field, and then select descending.  

     

  • mdevaney Profile Picture
    29,993 Moderator on at
    @ alex5p
    To make your gallery sorted from newest to oldest replace this section of your code:

    ReferralSystem

    With this code instead:

    Sort(ReferralSystem, ID, Descending)

    Your code looks good: there should not be any delegation warnings.

    To be absolutely certainly you can change the delegation limit to 1 in advanced settings temporarily. If only 1 records appear there is an issue. If all records appear there is no issue.

    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
  • alex5p Profile Picture
    210 on at

    I am sorry how is the syntax suppose to look? I know i am messing it up.

     

    Sort(ReferralSystem,DateofTextReferralText,Descending)
    Filter(
     ReferralSystem,
     StartsWith(Title, TextInput1.Text)
     || 
     StartsWith(DateofReferralText, TextInput1.Text)
     ||
     StartsWith(PhoneNumber, TextInput1.Text)
     ||
     StartsWith(CustomerName, TextInput1.Text)
     ||
     StartsWith(ContactName, TextInput1.Text)
     ||
     StartsWith(BackupName, TextInput1.Text)
     ||
     StartsWith(ReferredBy, TextInput1.Text)
     ||
     StartsWith(AreaOfInterest, TextInput1.Text)
     ||
     StartsWith(Department, TextInput1.Text)
     ||
     StartsWith(ReferredToName, TextInput1.Text)
    )
  • Verified answer
    dyee4614 Profile Picture
    283 on at

     

    Sort(Filter(
     ReferralSystem,
     StartsWith(Title, TextInput1.Text)
     || 
     StartsWith(DateofReferralText, TextInput1.Text)
     ||
     StartsWith(PhoneNumber, TextInput1.Text)
     ||
     StartsWith(CustomerName, TextInput1.Text)
     ||
     StartsWith(ContactName, TextInput1.Text)
     ||
     StartsWith(BackupName, TextInput1.Text)
     ||
     StartsWith(ReferredBy, TextInput1.Text)
     ||
     StartsWith(AreaOfInterest, TextInput1.Text)
     ||
     StartsWith(Department, TextInput1.Text)
     ||
     StartsWith(ReferredToName, TextInput1.Text)
    ),ID,Descending)

     

    This should work.  The source is going to be your filter formula.  The ID column is going to be what you're sorting and descending is how it should work.  If that works, make sure to mark mdevaney's post for accepted solution and not this one. 

     

  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at
    @alex5p
    My idea looks like this.

    Filter(
    Sort(ReferralSystem,ID,Descending),
    StartsWith(Title, TextInput1.Text)
    ||
    StartsWith(DateofReferralText, TextInput1.Text)
    ||
    StartsWith(PhoneNumber, TextInput1.Text)
    ||
    StartsWith(CustomerName, TextInput1.Text)
    ||
    StartsWith(ContactName, TextInput1.Text)
    ||
    StartsWith(BackupName, TextInput1.Text)
    ||
    StartsWith(ReferredBy, TextInput1.Text)
    ||
    StartsWith(AreaOfInterest, TextInput1.Text)
    ||
    StartsWith(Department, TextInput1.Text)
    ||
    StartsWith(ReferredToName, TextInput1.Text)
    )

    Thanks to @dyee4614 for jumping in to clarify. You mark more than one answer as the solution if needed.

    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
  • alex5p Profile Picture
    210 on at

    Thanks for your guys help! That code kind of helps but I suspect something may possibly be wrong with my data but not sure. When I put the sort it loos like it sort it but some reason the DateofReferralText(id) is starting at 9/22 when there should be ones from yesterday at 12/26 showing first.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @alex5p 

    Did you remember to Refresh the datasource in PowerApps Studio?

  • alex5p Profile Picture
    210 on at

    @mdevaney tried that and got same result. I tried a different date column I had and that worked. I am thinking b/c about 2800 of the rows i have in my sharepoint were pulled from our old system it was acting weird with the new data. I am now pulling off my date field instead of my date being converted to text field. that was kinda confusing what I said lol but it works now thank you guys for your help! @mdevaney @dyee4614 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard