How to use variable name for column in string manipulation Node

Hi,

I have a file with different column names. With a value selection Node I can choose a column. (f.i. “Col9” ) This column name is put into a variable with name WellName.

Now I like to use node String Manipulation to get a substring of the last two characters of the values in this column.

If I use the String Manipulation Node just with the original ColumnName “Col9” , substr($Col9$,length($Col9$)-2 ) , then I get the last two characters of the values in this column “Col9”.
But if I use the variablename “WellName” in this StringManipulation Node, substr($${SWellName}$$,length($${SWellName}$$)-2 )
then I only get “l9” as the new values in this column.

Does anybody have an idea what I do wrong?

Thanks,

RonG

Hi @RonG

That’s because the variable only captures the column name as a standalone string and not all values. A Column Expression is more suitable for this because you can use the column() function in here which the String Manipulator does not have. This takes the actual value.

substr(column(variable("WellName (column)")),length(column(variable("WellName (column)")))-2)

See example:

1 Like

Hi Arjen,

thanks for the solution. Thought I had to do this with the String manipulation Node, but this works great

RonG

1 Like

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