Expressions node behaves not as expected

Dear KNIMErs,

I am playing around with the Expressions node. I want to nest 2 formulas inside each other. One replace formula, that overwrites basically a timestamp. Than - outside of this, a join formula that creates a new timestamp.

Here’s my expressions formula:
join($["varDateTimeSelected_Arr[0]"],"T", regex_replace($["varDateTimeSelected_Arr[1]"], "[0-9]", "0"))

But other than expected it creates a pretty strange string with the T that separates date and time in the beginning. I don’t see a place where I have told it to do so.

Any ideas?

Hey @kowisoft

Can you maybe share what the input - i.e. varDateTimeSelected_Arr[0] and varDateTimeSelected_Arr[1] look like?

Is it a regular date&time timestamp that you can generate with Date&Time widget, which is then separated using Cell Spliter with “T” as delimiter?

EDIT:

Another edit… I took a look at the examples and you need to put the Separator you want to have between your data points first:

join("T",$["varDateTimeSelected_Arr[0]"], regex_replace($["varDateTimeSelected_Arr[1]"], "[0-9]", "0"))

2 Likes

Ah, I see. The problem was sitting (once again) in front of the computer.

I was assuming that the Expressions node behaves just like the Column Expressions / String Manipulation node, where the “,” was the separator.

But as far as I have understood now, basically anything could be the separator, but a separator needs to be defined.

So either

join("", "2025-01-29","T","00:00:00")

as well as

join("T","2025-01-29","00:00:00"

would be working.

Both should result in
2025-01-29T00:00:00

I have added an example workflow with 3 possible solutions here:

  1. Using the old method: Joining wiht String Manipulation
  2. Using the new method (option 1): Joining with Expressions, using “T” as a separator
  3. Using the new method (option 2): Joining with Expressions, using “” as a separator
2 Likes

Just so you know as I now realise my edit may sound a little condescending:

I initially fell into the same trap and had this topic moved to feedback incl. screenshots of the issue, a workaround for you and a WF that reproduces the issue :D.

Only accidentally I looked at the examples and realised it was a syntax topic ;-).

I obviously deleted the “incorrect” parts on my end during second edit.

1 Like

Hi,

the new Expression node supports concatenating strings using the “+” operator like $["ID"] + ": " + $["name"] + " ($" + $["price"] + ")", which likely is an easier option compared to using the join() function.

Column Expressions (legacy) Expression
join(“a”, “b”) “a” + “b”
joinSep(“&”, “a”, “b”) join(“&”, “a”, “b”)

Have a nice day,
nan

4 Likes

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