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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Distinct Function Comb...
Power Apps
Unanswered

Distinct Function Combo Box

(0) ShareShare
ReportReport
Posted on by 94

Hi all

 

I have a SQL table called Times which contains an Order No. column. I have tried using the distinct function to get these unique order numbers to appear as options within the combo box. This way any user can enter a new order number into the SQL database and only unique values will appear as options for the combo box. The code is as follows:

Screenshot 2023-07-25 121531.png

 

This outputs only two options and doesn't allow searching.

 

Any help would be great thanks!

Categories:
I have the same question (0)
  • victorcp Profile Picture
    2,350 Moderator on at

    Hi,

    How any itens exist in your SQL? 

    Power Apps will retrieve the first 500 itens (you can also raise this limit to 2000) and then apply the distinct, if you have more itens than that I suggest changging this approach.

     

    And you can enable the search here:

    victorcp_0-1690286076836.png

     

    I hope it helps 🙂

  • R45 Profile Picture
    94 on at

    Hi @victorcp 

     

    There is 65000 records in the database. What other methods would you propose?

     

    Cheers

  • Talha_Dar Profile Picture
    870 Super User 2024 Season 1 on at

    Hi @R45,

     

    Here is an expression that displays only the first 500 items when no search is performed and filters the table when a value is added to the search.

     

    If(
     ComboBox.SearchText = "",
     FirstN(
     Distinct(
     listName,
     columnName
     ),
     500
     ),
     Distinct(
     Filter(
     listName,
     columnName = ComboBox.SearchText
     ),
     columnName
     )
    )

     

    If you found my answer helpful, please consider giving it a thumbs-up or a like. Your feedback is greatly appreciated!

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • victorcp Profile Picture
    2,350 Moderator on at

    You can use the expression created by @Talha_Dar.

    or

    you can create another table with the all the available Order n°

  • R45 Profile Picture
    94 on at

    Hi @victorcp @Talha_Dar 

     

    Thank you for your response. I have implemented the above code and it works. How can I make it possible to enter an order number and that appear in the combo box options once the record has been submitted. Right now I can only select from the combo box (works) or type a value in (fails)?

     

    If(
    OrderNumber1.SearchText = "",
    FirstN(
    Distinct(
    Orders,
    OrderDistinct
    ),
    500
    ),
    Distinct(
    Filter(
    Orders,
    OrderDistinct = OrderNumber1.SearchText
    ),
    OrderDistinct
    )

     

  • Talha_Dar Profile Picture
    870 Super User 2024 Season 1 on at

    Hi @R45,

     

    You can use the following formula on the 'Update' property of your data card. It will update the value in your data source to the selected value if a value is chosen or create a new value if there is no existing value with a similar name.

     

    Patch(
     listName,
     LookUp(listName, ID=1 // or some condition to get the record to update),
     {
     lookupColumnName: DropDown.Selected
     }
    )

     

    If you found my answer helpful, please consider giving it a thumbs-up or a like. Your feedback is greatly appreciated!

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 368 Super User 2026 Season 1

#1
Kalathiya Profile Picture

Kalathiya 368 Super User 2026 Season 1

#3
WarrenBelz Profile Picture

WarrenBelz 318 Most Valuable Professional

Last 30 days Overall leaderboard