Expression Node: Unable to use Variables for Column Referentiation?

Hi,

maybe I am using it improperly but it seems that the new Expression node struggles to dynamically access a column by using the column name as a variable:

column(variable("currentColumnName")) - column(variable("currentColumnName"), 1)

Expression Node

As follows the working example using the Column Expression Node

Best
Mike

Hi Mike!

Correct, in the new Expression node you cannot dynamically access columns. Think of it more like an Excel formula. This has a few reasons, one of them is that by allowing static column access only, we can determine ahead of time which data the expression will need and thus make data access faster.

If you really need dynamic access, could something like this help?

switch($$["currentColumnName"],
       "A": $["A"],
       "B": $["B"], ...)

Admittedly not super nice and you need to know the names of all possible columns in advance.

Cheers,
Carsten

1 Like