{{ transformations:ExpressionFilterAction.png}}
====== FILTER BY CONDITION======
Category: Transform / Filters\\

\\ 
=====Description=====
This action calculates an [[syntax:start|expression]] for every row and keeps only rows where this expression is TRUE. All other rows are removed.  If no rows satisfy the condition then all rows are removed.\\

\\
=====Use cases=====
  *Create subsets of a dataset based on values across multiple columns.
  *Clean a dataset by removing records that don't meet certain criteria, or evaluate to a certain value. \\

\\ 
=====Action settings=====
^Setting ^Description ^
|Expression|Enter an expression that evaluates to a boolean TRUE/FALSE result.  The expression will be applied to each\\ record and remove records that do not meet the criteria (evaluate to FALSE).|

\\
=====Remarks=====
The expression must be a valid condition -- it must return either TRUE or FALSE for any row in the table. If it results in a non-boolean value (i.e. not TRUE or FALSE) for at least one row it will cause a project execution error.\\

Examples of valid conditions:
<code>
[Amount]=0
  
[Length] * [Width] * [Height] <= 1000
  
contains([City], 'York')
  
not isempty([Email])

[Date] >= #2024-02-01 and [Date] <= #2024-02-29
</code>  


\\ 
=====Examples=====

====Example #1====
>Find all mountains that are taller than 8600 m.\\

===Before (source table)===
^Rank  ^Mountain ^Height (m)  ^
|  1|Mount Everest  |  8848.86|
|  2|K2   |  8611|
|  3|Kangchenjunga  |  8586|
|  4|Lhotse  |  8516|
|  5|Makalu  |  8485|
|  6|Cho Oyu  |  8188|

===After (result table)===
^Rank  ^Mountain ^Height (m)  ^
|  **1**|**Mount Everest**  |  **8848.86**|
|  **2**|**K2**   |  **8611**|

===Action parameters===
> Expression: [Height (m)] > 8600


\\ 
=====Community examples=====
  * [[https://community.easymorph.com/t//675/5|Compare two Excel sheets with EasyMorph]] ([[https://community.easymorph.com/uploads/short-url/xQLWtAogCqcMrglyfXLKmrAF7aR.morph|Project]]; Module: //Main//; Group: //Main//; Table: //Result//; Action position: //3//)
  * [[https://community.easymorph.com/t//1625/4|Create a new table with columns based on row values]] ([[https://community.easymorph.com/uploads/short-url/4oGLUNDHrUfB971H80ciuOAtOTG.morph|Project]]; Module: //Module 1//; Group: //Tab 1//; Table: //Table 1//; Action position: //2//)
  * [[https://community.easymorph.com/t//1649/4|Update existing data in a database table]] ([[https://community.easymorph.com/uploads/short-url/yB6WDyNxKmlLT3bbm6mTr76C4Ri.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Where clause//; Action position: //2//)
  * [[https://community.easymorph.com/t//1766/1|Load only workbooks with given number of sheets]] ([[https://community.easymorph.com/uploads/short-url/AbWPlfPVBecqgZUBVTYlljwb9NO.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Get file names to load//;\\ Action position: //5//)
  * [[https://community.easymorph.com/t//2041/6|Join 2 tables with multi criterions equal and not equals in where]] ([[https://community.easymorph.com/uploads/short-url/kNkqMsDYMJjzjiN4C5g8O4g3YlA.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Join//; Action position: //3//)

\\ 
=====See also=====
  * [[transformations:selectionfilter|Filter]]
  * [[transformations:searchfilter|Filter by search]]
  * [[transformations:filterbytype|Filter by type]]
  * [[syntax:start|Expressions:  Expression syntax]]
