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
Community Support

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

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

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

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (31,342)