cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Community Support Team
Community Support Team

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.
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. 

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,550)