cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

filter 1 table based on other table

Hi,

I'm trying to populate a combobox with values from 1 table, filtered on the condition that they are present in a different table
this is a simplified view of my database: https://i.imgur.com/9MlYefY.png
I am trying to display the name field of the addresses table, but only for the ones which codes are present in one of those 3 columns in the planning table

I have tried using this filter:

Filter('[dbo].[BIT_Addresses]',code in(('[dbo].[BIT_Planning]').'Load./disch.') Or code in('[dbo].[BIT_Planning]'.To) Or code in('[dbo].[BIT_Planning]'.From)).name

but that is not giving me all of the names

I've also tried using a flow which executes an SQL query, but I can also not get that result to show in a dropdown menu, this is an example of the json the query returns: https://pastebin.com/UiJbQk53

any advice on how I can get the filter to work or how to get the SQL results to show up in my combo box would be greatly appreciated 🙂

- Annie

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: filter 1 table based on other table

Hi @Anonymous ,

Could you please share a bit more about your issue?

Do you mean that you could not get all available values within the ComboBox?

 

Based on the formula that you provided, I could not find any syntax error with it. Please modify your formula as below:

Filter(
'[dbo].[BIT_Addresses]',
code in '[dbo].[BIT_Planning]'.'Load./disch.' || code in '[dbo].[BIT_Planning]'.To || code in '[dbo].[BIT_Planning]'.From
).name

then check if the issue is solved.

 

In addition, please also take a try to save your two SQL Tables records into two separated collections, then use the Collections as data source within your app instead of Original SQL Tables. Please take a try with the following workaround:

Set the OnStart property of the App control or set the OnVisible property of the first screen of your app to following:

ClearCollect(
              PlanningCollection,
              '[dbo].[BIT_Planning]'
);
ClearCollect(
AddressCollection,
'[dbo].[BIT_Addresses]'
);

Then modify your formula as below:

Filter(
        AddressCollection,
        code in PlanningCollection.'Load./disch.' || code in PlanningCollection.To || code in PlanningCollection.From
).name

please take a try with above formula, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Re: filter 1 table based on other table

Hi @v-xida-msft 

it was indeed not showing all available values in the combobox, it only showed 4 but there should've been 38 options. Even weirder, when I change isSearchable to true, it's not showing anything. 

I tried both your suggestions, unfortunately, they both did not work. The first filter had the same result with only showing 4 results, and the second suggestion showed none. 

Highlighted
Anonymous
Not applicable

Re: filter 1 table based on other table

Hey @v-xida-msft,
do you have anything else I could try?  😕 

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,319)