Page tree

 

Support | BlogContact Us | 844.332.2821

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

D toc
 

Excerpt

Renames one or more columns based on specified names, patterns, row values, or prefixes and suffixes.  

Info

NOTE: Column names are case-insensitive. They must begin with a letter and can contain alphanumeric values and underscores (_). Spaces are not permitted.

...

This transform supports multiple methods for renaming two or more columns in a single step. See below for examples.

D s
snippetParameters

D code

rename: col: column_ref [prefix: 'strPrefix'] [suffix: 'strSuffix'] [mapping: [column1,'newColumn1Name'], [column2,'newColumn2Name']] [on: `patternOrLiteral`] [with: 'replacementString'] [sourceRowNumber: intRowNum]

TokenRequired?Data TypeDescription
renameYtransformName of the transform
colYstringName of column or columns to rename
prefixNstring(batch column) Prefix to prepend to the column name
suffixNstring(batch column) Suffix to append to the column name
mappingNarray(batch column) Array containing mappings from old column name and new column name
onNstring(batch column) Pattern or string literal for which to search each column name
withNstring(batch column) Replacement value for found pattern or string literal in column names
sourcerownumberNinteger(batch column) Row number from the source data to use as the new names for the selected columns

...

Old column nameNew column name
column1FirstName
column2
LastName
column3
Phone

Transform step:

D code

rename mapping: [column1,'FirstName'],[column2,'LastName'],[column3,'Phone']


D s
snippetusage

Required?Data Type
NoArray

...

column1column2column3column4column5
data1data2data3data4data5


Transform:

Add prefix:

D code

rename col: column1,column2,column3,column4,column5 prefix: 'new_'

new_column1new_column2new_column3new_column4new_column5
data1data2data3data4data5


Add suffix:

D code

rename col: new_column1,new_column2,new_column3,new_column4,new_column5 suffix: 'a'

new_column1anew_column2anew_column3anew_column4anew_column5a
data1data2data3data4data5

Find and replace:

D code

rename col: new_column1,new_column2,new_column3,new_column4,new_column5 on:'_column' with: 'Field'

new_Field1anew_Field2anew_Field3anew_Field4anew_Field5a
data1data2data3data4data5

Manual rename:

D code

rename mapping: [newField1a,'firstColumn'],[newField2a,'secondColumn']

firstColumnsecondColumnnew_Field3anew_Field4anew_Field5a
data1data2data3data4data5

Use row as header:

D code

rename sourcerownumber: 2

data1data2data3data4data5
data6data7data8data9data10

...