{{ transformations:FilterByTypeAction.png}}
====== FILTER BY TYPE ======
Category: Transform / Filters\\

\\ 
=====Description=====
This action filters values depending on their [[syntax:types|data type]]. Filtering can be applied to several columns at once, as well as multiple data types.\\

\\
=====Use cases=====
Filtering by type helps detect data quality issues by ensuring that columns in the exported dataset are strongly typed (i.e. all values in a column are of the same type). This might be required before exporting into a target system with strongly typed fields, such as a relational database or a Tableau data extract.

\\ 
=====Action settings=====
^Setting ^Description ^
|Filter mode|Select whether to keep or remove values of the types specified.  Options:  //Keep only values of selected type(s)// or\\ //Remove values of the selected types//.|
|Data types|Select the data types to be filtered by.  Options:  //Text//, //Number//, //Boolean//, //Error//, and //Empty (null)//. |
|Columns to check|Select whether to check the entire table or specific columns.  Options:  //Entire table// or //Particular columns// (and\\ select the columns to check).|

\\
=====Remarks=====
In cases where no values match the search string:
  * If //Keep only values…// was selected, the result will be an empty dataset.
  * If //Remove values…// was selected, the result will be the full dataset (no rows removed).

Filtering our (or keeping) //errors// refers to errors produced within EasyMorph (shown in red type).  Errors generated within imported data are captured as //text values//, not errors (e.g. a "#DIV/0!" error in Excel).

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

====Example #1====
>Filter out all non-numeric values in the "Length (km)" column.\\

===Before (source table)===
^River  ^Length (km)  ^Continent  ^
|Nile  |  6650|Africa  |
|Amazon  |NA  |South America  |
|Yangtze  |  6300|Asia  |
|Mississippi  |  6275|North America  |
|Yenisei  |   |Asia  |
 
===After (result table)===
^River  ^Length (km)  ^Continent  ^
|**Nile**  |  **6650**|**Africa**  |
|**Yangtze**  |  **6300**|**Asia**  |
|**Mississippi**  |  **6275**|**North America**  |

===Action parameters===
> Filter mode: Keep only values of selected type(s)
> Data types:  Number
> Columns to check: Particular columns (Length (km))

\\
====Example #2====
>Remove all rows with calculation errors.

===Before (source table)===
^Name  ^Sold  ^Goal  ^Sell Pct ^
|Mark  |  12|  16|  .75|
|Sava  |  10|  12|  .83|
|Mary  |  0|  0|#error|
|Marta  |  7|  7|  1.00|
|Eric  |   0|  0|#error|
 
===After (result table)===
^Name  ^Sold  ^Goal  ^Sell Pct ^
|**Mark**  |  **12**|  **16**|  **.75**|
|**Sava  **  |  **10**|  **12**|  **.83**|
|**Marta**  |  **7**|  **7**|  **1.00**|

===Action parameters===
> Filter mode: Remove values of selected type(s)
> Data types:  Error
> Columns to check: Particular columns (Sell Pct)

\\ 
=====Community examples====
  * [[https://community.easymorph.com/t//2653/1|Extracting all projects published in the Community and their actions]] ([[https://community.easymorph.com/uploads/short-url/mrnJQUJJL8Do1T8ioicyzE1VgmK.morph|Project]]; Module: //Get projects//; Group: //Tab 1//; Table: //Project links//; Action position: //4//)

\\ 
=====See also=====
  * [[transformations:selectionfilter|Filter]]
  * [[transformations:filter|Filter by condition]]
  * [[transformations:searchfilter|Filter by search]]
  * [[transformations:haltontypemismatch|Halt on data type mismatch]]