cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Krisslee6
Helper I
Helper I

Filter array is not working when Greater than condition is applied

Hi There,

 

Fitter Array  not working when applied the below condition.

I need only the array of values where the COUNT(*) > 50 but my flow is returning all the values.

 

It will be a great help to know what is going wrong.

 

 

Krisslee6_0-1631447821026.png

 

 

Below is my flow:

 

Krisslee6_1-1631447917199.png

Filter Array 2 code view.

{
    "inputs": {
        "from""@variables('ArrayOfContent')",
        "where""@equals(items('Apply_to_each')['COUNT(*)'], 1)"
    }
}
 
 

Below is the Array of Content 

______________________________________________________

[
{
"TRUNC(SYS_CREATION_DATE)\t": "11/09/2021 00:00:00",
"LETTER_CODES": "CONS",
"ERROR_CODE": "508",
"ERROR_REASON": "LmsException: Exception caught during SOAP Request Call to DMAAS Web Service.",
"COUNT(*)": "1"
},
{
"TRUNC(SYS_CREATION_DATE)\t": "11/09/2021 00:00:00",
"LETTER_CODES": "CONT",
"ERROR_CODE": "11",
"ERROR_REASON": "ArrayIndexOutOfBoundsException: 1",
"COUNT(*)": "3"
},
{
"TRUNC(SYS_CREATION_DATE)\t": "11/09/2021 00:00:00",
"LETTER_CODES": "CONTRACT",
"ERROR_CODE": "11",
"ERROR_REASON": "ArrayIndexOutOfBoundsException: null",
"COUNT(*)": "82"
},
{
"TRUNC(SYS_CREATION_DATE)\t": "11/09/2021 00:00:00",
"LETTER_CODES": "CONT",
"ERROR_CODE": "11",
"ERROR_REASON": "ArrayIndexOutOfBoundsException: null",
"COUNT(*)": "57"
}

]

*******************************

 

Should return only the below values where COUNT(*) > 50

 

[

{
"TRUNC(SYS_CREATION_DATE)\t": "11/09/2021 00:00:00",
"LETTER_CODES": "CONTRACT",
"ERROR_CODE": "11",
"ERROR_REASON": "ArrayIndexOutOfBoundsException: null",
"COUNT(*)": "82"
},
{
"TRUNC(SYS_CREATION_DATE)\t": "11/09/2021 00:00:00",
"LETTER_CODES": "CONT",
"ERROR_CODE": "11",
"ERROR_REASON": "ArrayIndexOutOfBoundsException: null",
"COUNT(*)": "57"
}

]

*******************************

 

Regards,

RK

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

What is happening is that you are applying a greater comparison to a value that is actually a string. Instead of using the dynamic content COUNT(*) on the left side of your comparison. You need to convert it to an integer first, by wrapping that dynamic value within the Int() expression. Then your filter will work.

View solution in original post

1 REPLY 1
Paulie78
Super User
Super User

What is happening is that you are applying a greater comparison to a value that is actually a string. Instead of using the dynamic content COUNT(*) on the left side of your comparison. You need to convert it to an integer first, by wrapping that dynamic value within the Int() expression. Then your filter will work.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,360)