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 / optimize code search w...
Power Apps
Answered

optimize code search with sql server table

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a dropdown, that is searching against a table in sql server.

The dropdown is looking for  option box selection.

There are only 4000 items in the table, but seems a little sluggish on returning records:

 

Is there a way to optimize this code for better performance ?

If(rdo_SearchChoice.Selected.Value = "Track Code", Filter('[dbo].[v_nsc_trackcode_assigned]',StartsWith(Track_code,cbo_ComboSearch.SearchText)),
rdo_SearchChoice.Selected.Value ="Seller", Filter('[dbo].[v_nsc_trackcode_assigned]',StartsWith('Aligned CSM/MAM',cbo_ComboSearch.SearchText)),
rdo_SearchChoice.Selected.Value ="Track Name", Filter('[dbo].[v_nsc_trackcode_assigned]',StartsWith(Track_Name,cbo_ComboSearch.SearchText)),
rdo_SearchChoice.Selected.Value ="Director", Filter('[dbo].[v_nsc_trackcode_assigned]',StartsWith('Director Name',cbo_ComboSearch.SearchText)))

 

 

Dave

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    I thought we simplified this in another thread...

    Filter('[dbo].[v_nsc_trackcode_assigned]',
     Switch(rdo_SearchChoice.Selected.Value,
     "Track Code", StartsWith(Track_code,cbo_ComboSearch.SearchText),
     "Seller", StartsWith('Aligned CSM/MAM',cbo_ComboSearch.SearchText),
     "Track Name", StartsWith(Track_Name,cbo_ComboSearch.SearchText),
     "Director", StartsWith('Director Name',cbo_ComboSearch.SearchText)
     )
    )

     

    The results will most likely not be any faster though with that number of records and not knowing any optimizations you might have on your SQL.

    Make sure that you have all 4 columns you are using in your StartsWith indexed.  That would be a good first step.

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 294 Most Valuable Professional

#2
11manish Profile Picture

11manish 210

#3
Valantis Profile Picture

Valantis 169

Last 30 days Overall leaderboard