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 / Filtering SQL from Com...
Power Apps
Answered

Filtering SQL from Combobox

(0) ShareShare
ReportReport
Posted on by 119

I'm trying to filter a dropdown from a combobox.selected items.  Data source is SQL for both.  I believe you can't filter directly, so I have an OnChange event for combobox to concat the list of selected items together and then filter dropdown from that selected list.  Like this pseudocode:

ComboBox OnChange():

UpdateContext({varBranchCodes:Concat(cboBranches.SelectedItems,branchcode,", ")})

 

Then, for dropdown Items():

Filter(Active_Patients, varBranchCodes in CltBranch)

 

This works fine if there are 1 BranchCode selected, but as soon as I choose 2 or more, the "in" statement doesn't return any records.  I can go to the SQL source and select using those BranchCodes and return data no problem.  What am I doing wrong?

Categories:
I have the same question (0)
  • subsguts Profile Picture
    1,259 Moderator on at

    did you read this post:  Solved: Issue with "in" operator inside "Filter()" functio... - Power Platform Community (microsoft.com)

     

    Sounds like it may be the answer to your question too?

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @Tommy-Upton,

    Modify the formula as below:

    Filter(Active_Patients, varBranchCodes in Concat(CltBranch,CltBranch,","))
    

    This formula will filter items that includes all the value selected in the combo box.

    (the combo box select a,b; you will only get records with value like this: a,b,c ; ab,d)

    ForAll(cboBranches.SelectedItems,Filter(Active_Patients,branchcode in CltBranch))

    If you want to filter items that only includes parts of value selected in the combo box, you could try this:

    (the combo box select a,b; you will  get records with value like this: a,c ;b,c ;a,b,c)

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard