cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

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

Re: Filtering an Array and then filtering the new data again

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
Highlighted
Solution Specialist
Solution Specialist

Re: Filtering an Array and then filtering the new data again

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

Highlighted
Community Support
Community Support

Re: Filtering an Array and then filtering the new data again

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.

Highlighted
Helper III
Helper III

Re: Filtering an Array and then filtering the new data again

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

Highlighted
Community Support
Community Support

Re: Filtering an Array and then filtering the new data again

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.

Highlighted
Helper III
Helper III

Re: Filtering an Array and then filtering the new data again

@v-litu-msft 

 

The end query is not filtered.

 

Thanks

Highlighted
Community Support
Community Support

Re: Filtering an Array and then filtering the new data again

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.

Highlighted
Helper III
Helper III

Re: Filtering an Array and then filtering the new data again

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

Highlighted
Community Support
Community Support

Re: Filtering an Array and then filtering the new data again

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.

Highlighted
Helper III
Helper III

Re: Filtering an Array and then filtering the new data again

Hi @v-litu-msft 

 

Here is an image of what I see.

 

Thanks 

 

sammybridge_0-1599041529627.png

 

Highlighted
Community Support
Community Support

Re: Filtering an Array and then filtering the new data again

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

Highlighted
Helper III
Helper III

Re: Filtering an Array and then filtering the new data again

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

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,062)