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 / Combobox connected to ...
Power Apps
Answered

Combobox connected to SQL Table over 5900 items

(0) ShareShare
ReportReport
Posted on by 1,512

@RandyHayes 

You helped me to get this code working before, hoping you can help me again.

 

Here is what I need to do.

 

I have changed the connection to data to a SQL Table called Vendors, I need to add search to the original code you provided so it will search either based on the VendorId or Name fields from the SQL table.

 

I am struggling to make this happen.

Here is the code you helped me with and my attempt

With({_searchText: SQLSearchTextInput.Text,
 _items: 
 Ungroup(
 Table(
 {_src:"CR", Items:
 AddColumns(colContractDataRecords, 
 "ContractNo_ID", If(!IsBlank(GrantContractNumber), GrantContractNumber & " - ") & Counterparty,
 "_altSort", If(IsBlank(GrantContractNumber), 1, 0)
 )
 },
 {_src:"VL", Items:Vendors}
 ),
 "Items"
 ),
 
 _use: If((DataCardValue2_2.Selected.Value="Legal" && Radio2.Selected.Value = "Direct") || DataCardValue2_2.Selected.Value="Direct", "VL", "CR")
 },
 Filter(
 ShowColumns(
 SortByColumns(
 ForAll(
 Filter(
 _items, 
 _src=_use && (!IsBlank(_searchText) && 
 (
 VendorId in _searchText ||
 Name in _searchText
 ))
 ),
 Switch(
 DataCardValue2_2.Selected.Value, 
 "Direct", {Value: VendorId & " - " & Name, _sort: 0}, 
 "Contract", {Value: ContractNo_ID, _sort: _altSort},
 "Legal", 
 Switch(
 Radio2.Selected.Value, 
 "Direct", {Value: VendorId & " - " & Name, _sort: 0},
 "Contract", {Value: ContractNo_ID, _sort: _altSort}
 )
 )
 ),
 "_sort", SortOrder.Ascending, 
 "Value", SortOrder.Ascending
 ),
 "Value"
 ),
 !IsBlank(Value)
 )
)

I do not know if this is even possible.  If I have to put in a text lookup then change it from a combobox to a label I am fine with that just seems like I should be able to do it all at once.

 

The issue is that the SQL table has 5900 items in it so I want it to filter as the person types, Yes I know there is a concat in this code, that is why I broke it apart, still not working to bring in all of the list or filtering to what is being type.

 

 Thank you in advance.

Categories:
  • Verified answer
    Dorinda Profile Picture
    1,512 on at

    @RandyHayes helped me get this resolved and works like a charm!!  Thanks Randy for rescuing me again!!

    With({_items: 
     Ungroup(
     Table(
     {_src:"CR", Items:
     AddColumns(colContractDataRecords, 
     "ContractNo_ID", If(!IsBlank(GrantContractNumber), GrantContractNumber & " - ") & Counterparty,
     "_altSort", If(IsBlank(GrantContractNumber), 1, 0)
     )
     },
     {_src:"VL", Items: Filter(Vendors, Self.SearchText in VendorId || Self.SearchText in Name) }
     ),
     "Items"
     ),
     
     _use: If((DataCardValue2_2.Selected.Value="Legal" && Radio2.Selected.Value = "Direct") || DataCardValue2_2.Selected.Value="Direct", "VL", "CR")
     },
     Filter(
     ShowColumns(
     SortByColumns(
     ForAll(Filter(_items, _src=_use), 
     Switch(DataCardValue2_2.Selected.Value, 
     "Direct", {Value: VendorId & " - " & Name, _sort: 0}, 
     "Contract", {Value: ContractNo_ID, _sort: _altSort},
     "Legal", 
     Switch(Radio2.Selected.Value, 
     "Direct", {Value: VendorId & " - " & Name, _sort: 0},
     "Contract", {Value: ContractNo_ID, _sort: _altSort}
     )
     )
     ),
     "_sort", SortOrder.Ascending, 
     "Value", SortOrder.Ascending
     ),
     "Value"
     ),
     !IsBlank(Value)
     )
    )
    

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard