User Tools

Site Tools


transformations:searchfilter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
transformations:searchfilter [2017/12/23 10:04] – created dmitrytransformations:searchfilter [2025/01/20 01:28] (current) – [Example #2] craigt
Line 1: Line 1:
-===== Filter by search =====+{{ transformations:SearchFilterAction.png}} 
 +====== FILTER BY SEARCH ====== 
 +Category: Transform / Filters\\
  
-This transformation keeps or removes rows where values in specified column contain particular substring. It also supports filtering using a regular expression.+\\  
 +=====Description===== 
 +This action keeps or removes rows where values in specified column contain particular substring or match a regular expression.\\
  
-**Example of transformation**+\\ 
 +=====Use cases===== 
 +  *Create subsets of a dataset based on parts of values in a specific column (literal strings or regular expressions). 
 +  *Clean a dataset by removing records that may have "junk" data in a specific column. 
  
-**Source table:** The longest rivers in the world+\\  
 +=====Action settings===== 
 +^Setting ^Description ^ 
 +|Column|Select the column containing the values to be used for filtering. 
 +|Search type|Select what part of the values should match the search string.  See the table below.| 
 +|Search string<sup>*</sup>|Enter the string or regular expression to match in the selected column's values.  If "Regular expression" is selected\\ as the //Search type//, this setting changes to "Regular expression".| 
 +|Regular expression|This setting appears when "Regular expression" is selected as the //Search type// Enter the regular expression to\\ be evaluated against all values in the selected column.  See [[https://en.wikipedia.org/wiki/Regular_expression|regular expression]] for more information.| 
 +|Case sensitive|When checked, the case will not be considered when matching the search string.| 
 +|Filter mode|Select whether rows with matching values will be kept in the dataset, or removed. Options: //Keep only \\ matching values// or //Remove matching values//.| 
 +<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].
  
 +\\
 +=====Remarks=====
 +In cases where no values match the search string:
 +  * If //Keep only matching values// was selected, the result will be an empty dataset.
 +  * If //Remove matching rows// was selected, the result will be the full dataset (no rows removed).
 +
 +\\ 
 +=====Examples=====
 +
 +====Example #1====
 +>Find all rivers that start with 'Y'.\\
 +
 +===Before (source table)===
 +^River  ^Length (km)  ^Continent  ^
 +| Nile  |  6650| Africa  |
 +| Amazon  |  6400| South America  |
 +| Yangtze  |  6300| Asia  |
 +| Mississippi  |  6275| North America  |
 +| Yenisei  |  5539| Asia  |
 +| Yellow River  |  5464| Asia  |
 +| Ob  |  5410| Asia  |
 +| Paraná  |  4880| South America  |
 +
 +===After (result table)===
 ^  River  ^  Length (km)  ^  Continent  ^ ^  River  ^  Length (km)  ^  Continent  ^
-Nile  |  6650  |  Africa +**Yangtze**  |  **6300****Asia**  | 
-| Amazon  |  6400  |  South America +**Yenisei**  |  **5539****Asia**  | 
-Yangtze  |  6300   Asia  | +**Yellow River**  |  **5464****Asia**  |
-Mississippi  |  6275  |  North America +
-Yenisei  |  5539   Asia  | +
-| Yellow River  |  5464   Asia  | +
-| Ob  |  5410  |  Asia  | +
-| Paraná  |  4880  |  South America  |+
  
 +===Action parameters===
 +> Column: River
 +> Search type: Starts with
 +> Search string: "Y"
  
-**Objective:** Find all rivers that start with 'Y'.+\\ 
 +====Example #2==== 
 +>Find the phone numbers using the "(###) ###-####format.
  
-**Transformation parameters:**+===Before (source table)=== 
 +^ phone_nums ^ 
 +|111-222-3333 
 +|(555) 555-5555 
 +|+1 777-888-9999 
 +|444 555 6666  | 
 +|(123) 456-7890  |
  
-  * Column: River +===After (result table)=== 
-  * Search type: Starts with +^ phone_nums ^ 
-  * Search string: Y+|**(555) 555-5555**  
 +|**(123) 456-7890**  |
  
-**Output table:** +===Action parameters=== 
- River  ^  Length (km  Continent  ^ +> Columnphone_nums 
-| Yenisei  |  5539  |  Asia  +> Search type: Regular expression 
-Yellow River  |  5464  |  Asia  |+> Regular expression: "^\(\d{3}\)\s\d{3}-\d{4}$" 
 +> Keep only matching values 
 + 
 +\\  
 +=====Community examples===== 
 +  * [[https://community.easymorph.com/t//1475/1|Finding all projects with particular action]] ([[https://community.easymorph.com/uploads/short-url/cM8AssOT6zQXD8JDr9adUAy2sDM.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 2//; Action position: //3//) 
 +  * [[https://community.easymorph.com/t//1800/4|Download multiple files from HTTPS and copy to folder, preserving file names]] ([[https://community.easymorph.com/uploads/short-url/pQyGPi01bpxaWBHR6LdGlGMyRbH.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1//; Action position: //3//) 
 +  * [[https://community.easymorph.com/t//2051/1|How to search a text file (e.g. task log) and see result in Server Pages]] ([[https://community.easymorph.com/uploads/short-url/7ZHCVj2p6RV5j6paCUZCnho29vK.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1//;\\ Action position: //2//) 
 + 
 +\\  
 +=====See also===== 
 +  * [[transformations:selectionfilter|Filter]] 
 +  * [[transformations:filter|Filter by condition]] 
 +  * [[transformations:filterbytype|Filter by type]] 
 +  * [[transformations:regexp|Regular expression]]
transformations/searchfilter.1514041473.txt.gz · Last modified: 2017/12/23 10:04 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki