Using column names as an expression in String Manipulation

Hi Team,

Quick question regarding using flow variables as column names. I am trying to use the “Column List Loop Start” to do string manipulations across multiple columns. When I add the variable “$${ScurrentColumnName}$$” to the expression it is using the actual underlying column name string in the expression rather then the column (i.e. “$column1$” or “$column2$”). So as an example I am trying to get the MAX LENGTH of each column, but it is reading only the MAX length of the column name and not the actual column contents. Can anyone help with the appropriate way to use $${ScurrentColumnName}$$ as an expression?

Thanks in advance.

Use Column Expression node to get value by column name.

3 Likes

Hi,

As @izaychik63 mentioned you can pick the “Column Expressions” node in which you use the current column like this:
column(variable("currentColumnName"))
E.g. length(column(variable("currentColumnName")))

Or you can create your expression in a “String Manipulation (Variable)” node as a new variable:
E.g. join("length($", $${ScurrentColumnName}$$, "$)")
And then use this expression in “String Manipulation” node by assigning the variable to the “expression” option in “Flow Variables” tab:
expression

Best,
Armin

5 Likes

Excellent. Just what I needed! Thanks for the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.