Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Return Distinct List of Values for Combobox

(0) ShareShare
ReportReport
Posted on by 252

Hi All,

 

I have a sharepoint list of part numbers(3000+ records).  

 

Currently, I have a combo box, which allows me to search for a particular part.  I have the formula below

SortByColumns(Distinct('Tbl','Part No'),"Value")

 

However, this only looks at the first 2000 rows, is there a way to get over this so it will search all 3000+ records?

 

Thanks in Advance

Categories:
  • Skybluekid Profile Picture
    Skybluekid 252 on at
    Re: Return Distinct List of Values for Combobox

    Hi @Drrickryp 

     

    Thank you for the reply.

    I am getting an error on the highlighted section of the formula

    With({a: SortByColumns(Distinct('Tbl','Part No'),"Value"),

    b: Distinct(SortByColumns('Tbl','Part No'),"Value". SortOrder. Decending))}, Filter(b, Not(Value in a)) 

     

  • Skybluekid Profile Picture
    Skybluekid 252 on at
    Re: Return Distinct List of Values for Combobox

    Hi @ShaheerAhmad 

     

    Thanks for the reply.

     

    When entering the formula on "On Visible" for the screen, it comes up with an error

    Skybluekid_0-1686311597301.png

     

  • Drrickryp Profile Picture
    Drrickryp on at
    Re: Return Distinct List of Values for Combobox

    With({a: SortByColumns(Distinct('Tbl','Part No'),"Value"),

    b: Distinct(SortByColumns('Tbl','Part No'),"Value". SortOrder. Decending))}, Filter(b, Not(Value in a)) 

     

     

     

     

     

     

    @Skybluekid

  • Shaheer Ahmad Profile Picture
    Shaheer Ahmad 2,194 on at
    Re: Return Distinct List of Values for Combobox

    In Power Apps, there is a limitation on the number of records that can be retrieved from a SharePoint list using the Distinct function. By default, the Distinct function retrieves a maximum of 2000 records.

    To work around this limitation and retrieve all the distinct part numbers from your SharePoint list (with 3000+ records), you can use a combination of functions like Collect and GroupBy.

    Here's an example of how you can modify your formula to overcome the limitation:

    1. Add a collection to your app to store all the distinct part numbers. You can do this in the OnVisible property of the screen or another appropriate event. For example:

     

    ClearCollect(MyPartNumbers, GroupBy('Tbl', "Part No", "PartNumber"))

     

    • This Collect function with the GroupBy function will collect all the distinct part numbers from the 'Tbl' SharePoint list into the MyPartNumbers collection.

    • Set the Items property of your combo box to the MyPartNumbers collection:

     

     

    Items = MyPartNumbers

     

     

    1. This will populate the combo box with all the distinct part numbers from the collection.

    Note: Make sure to replace 'Tbl' with the actual name of your SharePoint list in the formula.

    By using the Collect and GroupBy functions, you can bypass the limitation on the number of records retrieved by the Distinct function. This approach will allow you to search through all 3000+ part numbers in your SharePoint list.

    of you can simple check this blog of mine to retrieve more than 2000 rows from sharepoint:

    https://shaheer365.blogspot.com/2023/05/retrieving-more-than-2000-rows-from.html 

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard