cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sammybridge
Helper IV
Helper IV

Filtering an Array and then filtering the new data again

I have a CDS Entity which has 2x Boolean (Yes/No) metadata fields which I need to filter independently.

 

My first step is to List the Records and then initialize an array variable with the items.

 

My first condition is looks up an option set field and depending on the result, I either Filter the Array for the first Boolean or do nothing.

 

My second condition then looks up another option set and again depending on the result, I either Filter the previous conditions data or again do nothing.

 

My first filter works fine but my second filter doesn't want to filter an already filtered array variable. Is this possible?

 

Capture.PNGCapture2.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @sammybridge,

 

Ok, it is correct. It should work if the column name is correct.

Let us change a method to test. How about using the expression to filter? Click the "Edit in advanced mode", then input the following expression:

@equals(item()?['Column_Name'], true)

Annotation 2020-09-03 105168.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
ManishJain
Solution Sage
Solution Sage

HI @sammybridge ,

 

Can you please share your screenshot of the output , also please ensure when you are listing records you are pulling all the required attributes for filter to work. 

 

Thanks

v-litu-msft
Community Support
Community Support

Hi @sammybridge,

 

I think the reason why the second condition not works is the Filter array action is not correct, on the left side, you could use the expression to extract the value you want to filter:

item()?['column_Name']

Annotation 2020-09-01 113613.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft ,

 

This is what I have in the left hand side. It goes in as an expression but when I save my flow it updates to look like I have selected it from the dynamic choices.

 

Thanks

Hi @sammybridge,

 

Ok, this situation indeed occur sometimes.

How does the send filter query look like? Is it an empty output or not-filtered?

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft 

 

The end query is not filtered.

 

Thanks

Hi @sammybridge,

 

If it is not filtered means all items satisfied the condition, you could create a simple instance to test it, for example:

Annotation 2020-09-02 110511.jpg

 

Annotation 2020-09-02 110512.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-litu-msft  this is incorrect. When I swap my filters around and put my second filter first, it filters on this one correctly. It is only filtering on the first filter and missing the second one. 

Hi @sammybridge,

 

Could you please peek code of the second filter action?

Annotation 2020-09-02 110513.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-litu-msft 

 

Here is an image of what I see.

 

Thanks 

 

sammybridge_0-1599041529627.png

 

Hi @sammybridge,

 

Ok, it is correct. It should work if the column name is correct.

Let us change a method to test. How about using the expression to filter? Click the "Edit in advanced mode", then input the following expression:

@equals(item()?['Column_Name'], true)

Annotation 2020-09-03 105168.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @v-litu-msft 

 

This now looks like it is working for some reason. I took the code out and replaced it back in and it is working.

 

Thanks for your help

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (62,317)