cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JoeQuick
Frequent Visitor

Filter array base multiple filters

I am able to create the array

I need to filter the results based on 2 fields, Less than FromFSC and greater than ToFSC

 

Problem1: If I just use GreaterThen than FromFSC   @greater(4.71, items('Apply_to_each')?['field_0'])

The whole table is returned even if FromFSC is less then 4.71

 

Problem2 : Same thing for the LessThen ToFSC   @Less(4.71, items('Apply_to_each')?['field_0'])

 

Problem3: I know what Im trying to do isnt complicated, What am I doing stupid?

 

Below is the output generated

0.03

0.04

0.05

0.06

0.07

0.08

0.09

0.1

0.11

0.12

0.13

0.14

0.15

0.16

0.17

0.18

0.19

0.2

0.21

0.22

0.23

0.24

0.25

0.26

0.27

0.28

0.29

 

And this is my list

FromFSC       ToFsc            FSCratee
1.501.740.03
1.751.990.04
2.002.190.05
2.202.390.06
2.402.550.07
2.562.700.08
2.712.850.09
2.863.000.10
3.013.100.11
3.113.200.12
3.213.300.13
3.313.400.14
3.413.500.15
3.513.600.16
3.613.700.17
3.713.800.18
3.813.900.19
3.914.000.20
4.014.100.21
4.114.200.22
4.214.300.23
4.314.400.24
4.414.500.25
4.514.600.26
4.614.700.27
4.714.800.28
4.814.900.29
4.915.000.30
  
1 ACCEPTED SOLUTION

Accepted Solutions
JoeQuick
Frequent Visitor

Thanks P, I dont think I went into enough detail with what I was trying to do. I involved to lists.

I will accpt as a solution for your time.

I will open a new ticket with greater detail.

View solution in original post

7 REPLIES 7
Pstork1
Dual Super User
Dual Super User

The condition you are looking for in the filter array would be something like this

@And(less(item()?['FromFSC'], 4.71),greater(item()?['ToFSC'], 4.71))

  



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
JoeQuick
Frequent Visitor

Hello again P,

 

Made the change and this is the error I got.

The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@And(less(item()?['FromFSC'], 4.71),greater(item()?['ToFSC'], 4.71)) ' failed: 'The template language function 'less' expects all of its parameters to be either integer or decimal numbers. Found invalid parameter types: 'Null'.'

That error is suggesting one of the values being tested is coming in as a null value. Check your data to make sure there are actual numbers in all the records. Its either that or the reference to the columns isn't correct.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
JoeQuick
Frequent Visitor

I have checked each column in the list using "the filter by" and the were no nulls or blanks showing.

I even exported the list to excel, I dont see any blanks.,and columns seem to be correct.

Title         FromFSC ToFsc     FSCrate

0.031.51.740.03
0.041.751.990.04
0.0522.190.05
0.062.22.390.06
0.072.42.550.07
0.082.562.70.08
0.092.712.850.09
0.12.8630.1
0.113.013.10.11
0.123.113.20.12
0.133.213.30.13
0.143.313.40.14
0.153.413.50.15
0.163.513.60.16
0.173.613.70.17
0.183.713.80.18
0.193.813.90.19
0.23.9140.2
0.214.014.10.21
0.224.114.20.22
0.234.214.30.23
0.244.314.40.24
0.254.414.50.25
0.264.514.60.26
0.274.614.70.27
0.284.714.80.28
0.294.814.90.29
JoeQuick
Frequent Visitor

And column names seem to be correct

Column names are case sensitive.  You reported the query as 

@And(less(item()?['FromFSC'], 4.71),greater(item()?['ToFSC'], 4.71))

ToFSC is ToFsc in the list you posted.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
JoeQuick
Frequent Visitor

Thanks P, I dont think I went into enough detail with what I was trying to do. I involved to lists.

I will accpt as a solution for your time.

I will open a new ticket with greater detail.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,965)