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 / Filter gallery using s...
Power Apps
Unanswered

Filter gallery using secondary SQL table

(0) ShareShare
ReportReport
Posted on by 638

Hello,

 

I'm using filtered values in Gallery 1.AllItems to filter Gallery 2 at the moment, this works fine for now while Gallery1 doesn't go over 100 records, so I've been looking to change my approach and filter Gallery 2 directly from the SQL Table I'm using for Gallery 1.

 

Gallery 2 must display ALL values it looks up from the SQL Table that meet a certain criteria.

 

If i just do a "Filter(Table, Column in Table2.Column) it works and displays all values existing in table 2.

 

But when I introduce a Lookup to the Table2 so I can introduce a Criteria, it only returns the FIRST value found.

 

This is the working code without conditions for Table 2

 

If(IsBlank(ComboBox1_1.Selected),
 
 Filter('Table1',Company in 'Table2'.Meeting,
 
 Status = If(Toggle1_5.Value,"Open","Completed")),

 Filter('Table1',Company = ComboBox1_1.Selected.Meeting,
 
 Status=If(Toggle1_5.Value,"Open","Completed")))

 

 

When I introduce a lookup on Table2 to search only for items which contain the user's email address, it returns only the first found value.

 

Any idea on how to overcome this?

 

Regards

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jbrit2020 

    Please consider changing your Formula to the following:

    Filter('Table1',
     (IsBlank(ComboBox1_1.Selected.Meeting) || (Company in 'Table2'.Meeting)) &&
     Status = If(Toggle1_5.Value,"Open","Completed")
    )

    In general using If statements to choose between different filters will double your work and make the formula more difficult to maintain.

     

    Now, you mentioned a Lookup in your post.  A lookup will only return the first record it encounters.  But I am not seeing how you are trying to incorporate that.  Can you expand more on what you are attempting to do with the lookup?

  • jbrit2020 Profile Picture
    638 on at

    @RandyHayes thank you for the tip.

     

    This still doesn't resolve however my issue with the condition for table 2 where "(Company in 'Table2'.Meeting))" should include a condition for Table2.

     

    Filter('Table1',
     (IsBlank(ComboBox1_1.Selected.Meeting) || (Company in 'Table2'.Meeting)) &&
     Status = If(Toggle1_5.Value,"Open","Completed")
    )

     

    Regards,

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jbrit2020 

    Yes, the prior response was not necessarily intended to resolve as I had an outstanding question - it was more of a generality.

    Can you expand more on what you mean by including a condition for Table2?

    You originally stated that something was only returning one record (the first) and mentioned Lookup - so I assumed you were using a LookUp that only returns one record.

     

    To get in your first formula - you were in one place doing an in operation to Table2 and then in another doing an equality to a selected company in a combobox.

     

    So, trying to understand a little more about what you're trying to get to.  Sorry if I'm not seeing it clearly.

  • jbrit2020 Profile Picture
    638 on at

    @RandyHayes yes I was using a lookup, which doesn't return all matching existing values, but only 1 value.

     

    The Key here is "Company" column in Table1, this Column matches the values on Meeting column in table 2.

     

    At the moment with the code I've pasted here my gallery is displaying ALL records that match ALL the records on Meeting Column in table 2, but I don't want compare the whole of Table 2. I only want to compare the records on table 2 that belong to a certain user. The user each record belongs to are on a second column called "MeetingAttendee".

     

    Hopefully this makes my problem slightly clearer.

     

    Regards

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard