User Tools

Site Tools


transformations:lookuprename

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
transformations:lookuprename [2020/02/19 04:18] dmitrytransformations:lookuprename [2021/07/15 12:42] – [Examples] craigt
Line 1: Line 1:
-===== Rename with lookup =====+{{ transformations:RenameColumnsAction.png}} 
 +====== RENAME COLUMNS BY LOOKUP ====== 
 +Category: Transform / Advanced\\
  
-Category: Transformation / Advanced+\\  
 +=====Description===== 
 +This action renames columns in a table by looking up old and new column names in another table.
  
-This action renames columns in a table looking up old and new column names in another table. It's typically used when names of columns to rename and/or the new names are not known in advance, and have to be obtained dynamically during a calculation, or from a set of known names in a lookup table.+The lookup table should have 2 columns: one containing the old namesand one listing the new names.\\
  
-The lookup table should have 2 columns: old names and new names.+\\  
 +=====Use cases===== 
 +This action is typically used when names of columns to rename and/or the new names are not known in advance and have to be generated dynamically during a calculation, or from a set of known names in a lookup table.\\
  
-After the action is applied, columns with old names from the lookup table will be renamed to the new names.+\\  
 +=====Action settings===== 
 +^Setting^Description^ 
 +|Lookup table|Select the table containing the old and new column name values.| 
 +|Column with old names|Select the column in the selected table that contains the original column name values.| 
 +|Column with new names|Select the column in the selected table that contains the new column name values.| 
 +The reference to the second table will appear as a dotted line connecting this action to the second dataset in the application window.\\
  
-**See also**+\\  
 +=====Remarks===== 
 +This action is //case sensitive// If the lookup values do not match the existing column names case-wise, a match is not made and the new column name is not assigned.
  
 +If a match to a column is not found in the "old names" lookup column, the column will retain its original name.\\
 +
 +\\ 
 +=====Examples=====
 +
 +**Objective:** Rename the columns in Table 1 using the old/new name pairings in Table 2.\\
 +\\  
 +**Table 1:**  Source table columns.
 +^FName  ^LName  ^Add1  ^Cty  ^ST  ^Zip  ^
 +
 +**Table 2:** Lookup table
 +^Old names  ^New names  ^
 +|FName  |FirstName  |
 +|LName  |LastName  |
 +|Add1  |Address  |
 +|Cty  |City  |
 +|St  |State  |
 +|Zip  |Zip Code |
 +
 +\\ 
 +**Action parameters:**
 +>Lookup Table is "Table 2"
 +>Column with old names is "Old names"
 +>Column with new names is "New names"
 +\\ 
 +**Result:** 
 +^FirstName  ^LastName  ^Address  ^City  ^ST  ^Zip Code  ^
 +Notice that "ST" wasn't renamed to "State" due to case issues ("ST" vs. "St").
 +
 +\\ 
 +====Community examples====
 +  * [[https://community.easymorph.com/t//1432/4|Dynamic transformation]] ([[https://community.easymorph.com/uploads/short-url/1wu0gGctfVxSdnVCjW8GdUymqcw.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Result//; Action position: //4//)
 +  * [[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: //Projects with sandboxes//; Action position: //3//)
 +  * [[https://community.easymorph.com/t//1803/3|Create dynamic list from delimited text (dynamic split/dynamic generate list)]] ([[https://community.easymorph.com/uploads/short-url/vd59gCPQiP8m4hiFPZmYiRDKW31.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Output//; Action position: //5//)
 +
 +\\ 
 +=====See also=====
 +  * [[transformations:rename|Rename columns]]
   * [[transformations:selectbylookup|Select columns by lookup]]   * [[transformations:selectbylookup|Select columns by lookup]]
 +
transformations/lookuprename.txt · Last modified: 2021/07/19 02:19 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki