We recommend switching to the latest versions of Edge, Firefox, Chrome or Safari. Using Internet Explorer will result in a loss of website functionality.

Preparing Data – Renaming Fields

Follow

Comments

6 comments

  • Avatar
    Jeffery Brown

    How does the newer node for "Modify Fields" add to being able to rename fields?

    1
    Comment actions Permalink
  • Avatar
    Adrian Williams

    Hi Jeff, thanks for the question.

    Yes you can rename individual fields or multiple fields using the Modify Fields node - without using any code.

    I have added a link at the start of this article to another article that describes the capabilities of the Modify Fields node.

    1
    Comment actions Permalink
  • Avatar
    Jeffery Brown

    Thanks Adrian! 

    0
    Comment actions Permalink
  • Avatar
    Daniel Rempel

    I have a dataset where all the field names contain spaces. Rather than entering a new name for each field, could I somehow use python replace(" ","_") to change all the spaces in all the field names at once?

    0
    Comment actions Permalink
  • Avatar
    Adrian Williams

    A combination of built in nodes and some scripting will perform the replacement.

    You can use the Get Metadata node to obtain the metadata for all fields in the input data set.

    A Transform node can then be used to replace the space characters in the metadata. 

    The node also outputs a 'newFieldType' field where all the values are set to Null.

    The output of the Transform node is input to the Change Metadata node on its 'metadata changes' input.

    The properties of the Change Metadata node can be left blank as the default fieldnames used by the Change Metadata node align with the field names output by the Transform node.

    When the Change Metadata node is run it modifies the metadata of the data on its 'input data' pin.

     

     

    0
    Comment actions Permalink
  • Avatar
    Adrian Williams

    It is not possible to attach a data flow file to a comment so I've added the example data flow for replacing all space characters in the field names to the end of the main article.

    0
    Comment actions Permalink

Please sign in to leave a comment.