cancel
Showing results for
Did you mean:
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.5 1.74 0.03 1.75 1.99 0.04 2 2.19 0.05 2.2 2.39 0.06 2.4 2.55 0.07 2.56 2.7 0.08 2.71 2.85 0.09 2.86 3 0.1 3.01 3.1 0.11 3.11 3.2 0.12 3.21 3.3 0.13 3.31 3.4 0.14 3.41 3.5 0.15 3.51 3.6 0.16 3.61 3.7 0.17 3.71 3.8 0.18 3.81 3.9 0.19 3.91 4 0.2 4.01 4.1 0.21 4.11 4.2 0.22 4.21 4.3 0.23 4.31 4.4 0.24 4.41 4.5 0.25 4.51 4.6 0.26 4.61 4.7 0.27 4.71 4.8 0.28 4.81 4.9 0.29 4.91 5 0.3

1 ACCEPTED SOLUTION

Accepted Solutions
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.

7 REPLIES 7
Most Valuable Professional

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 you like my response, please give it a Thumbs Up.
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'.'

Most Valuable Professional

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 you like my response, please give it a Thumbs Up.
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.03 1.5 1.74 0.03 0.04 1.75 1.99 0.04 0.05 2 2.19 0.05 0.06 2.2 2.39 0.06 0.07 2.4 2.55 0.07 0.08 2.56 2.7 0.08 0.09 2.71 2.85 0.09 0.1 2.86 3 0.1 0.11 3.01 3.1 0.11 0.12 3.11 3.2 0.12 0.13 3.21 3.3 0.13 0.14 3.31 3.4 0.14 0.15 3.41 3.5 0.15 0.16 3.51 3.6 0.16 0.17 3.61 3.7 0.17 0.18 3.71 3.8 0.18 0.19 3.81 3.9 0.19 0.2 3.91 4 0.2 0.21 4.01 4.1 0.21 0.22 4.11 4.2 0.22 0.23 4.21 4.3 0.23 0.24 4.31 4.4 0.24 0.25 4.41 4.5 0.25 0.26 4.51 4.6 0.26 0.27 4.61 4.7 0.27 0.28 4.71 4.8 0.28 0.29 4.81 4.9 0.29
Frequent Visitor

And column names seem to be correct

Most Valuable Professional

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 you like my response, please give it a Thumbs Up.
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.

Announcements