locked
ADF Data Flow Derived column - Dynamic column names RRS feed

  • Question

  • I have a Data Flow that has a source with one column (DataColumn).  I can parse the parts of that DataColumn column using substring and output it as a column HR1.

    What I want to to do is to pass in a parameter (Column1Name) and set that parameter to whatever I want (say HR2).  The derived column will create the column.

    What I have done so far;  I created Column Pattern:  name == 'DataColumn'.  In that pattern I added column:  name is $Column1Name and the expression is substring(DataColumn,1,2).  I have replaced DataColumn with $$.  The column is not created.

    Might be relevant:  I have a join before that, but the name DataColumn is unique after the join.


    Russel Loski, MCSE Data Platform/Business Intelligence Twitter: @sqlmovers; blog: www.sqlmovers.com

    Friday, November 1, 2019 1:53 PM

Answers

  • I did tried to work and repro your issue . I think the ask to pass the column name  as a parameter and then use the string function to have a custom name . I did used the join also . 

    Parameter Name : NewColumnNameFromParameter Value : 'helloWorld'

    Expression which you should use 

    substring($NewColumnNameFromParameter,1,5)

    The output which I see , the derived column name as 'hello' and it is derived from Name column .

    Let me know how it goes .


    Thanks Himanshu


    Monday, November 4, 2019 10:28 PM

All replies

  • I did tried to work and repro your issue . I think the ask to pass the column name  as a parameter and then use the string function to have a custom name . I did used the join also . 

    Parameter Name : NewColumnNameFromParameter Value : 'helloWorld'

    Expression which you should use 

    substring($NewColumnNameFromParameter,1,5)

    The output which I see , the derived column name as 'hello' and it is derived from Name column .

    Let me know how it goes .


    Thanks Himanshu


    Monday, November 4, 2019 10:28 PM
  • Worked like charm (I used right($Column1Name, 50)) .  It didn't protest that I had extra characters.

    That was the last piece to my solution.  Thank you so much Himanshu.


    Russel Loski, MCSE Data Platform/Business Intelligence Twitter: @sqlmovers; blog: www.sqlmovers.com

    Tuesday, November 5, 2019 5:16 PM