Bug: Expression Node shows syntax error by default

Description:
When first connecting Expressions node and opening the configuration dialogue, an error is shown “The expression has a syntax error”

This errors seems to be showing as long as there is no expression entered:

Steps to reproduce:
1.
2.
3.
4.
5.

Actual results:

Expected results:

Attachments:

**OS:**WIN11

1 Like

Hi @MartinDDDD,
This behavior is expected because we decided that an empty expression is not valid. Hovering the marker in the text shows (a little) more details:

However, I can see that this is not very friendly. What would you expect?

  • An empty expression is valid (what should the output be?)
  • The node opens with a valid example expression (what could that be?)
  • The error message below says “No expression present. Enter an expression.” (I like this because it seems easy enough. Is it good enough?)
3 Likes

Thanks for the feedback.

I think maybe the current behavior of Column Expressions can be used as a blueprint. If you just connect an Column Expressions node you can execute it straight away and get the same output as the input. I find this behavior useful when I work with the node as I can execute it, then configure it and work on my logic whilst still “seeing” the initial table in the table preview…

So what would that mean for Expressions?

No Expression = Pass-through of table.

This, of course, raises some new questions. I comparison to Column Expressions, Expressions node has by default one Expression for “New Column” defined → if it stays this way then maybe default output in “New Column” is “missing” if there is no expression configured.

Alternatively also align node behavior here - by default there is no expression and it is up to the user to add one by clicking a button…

Hope this makes sense…

My preference would be aligning with Column Expressions behavior so:

  • no default expression configured, user interaction required to “add the first”
  • no expression => pass through of input data
  • User added expression, but it is empty => show new column with “missing”

Hope this makes sense…

1 Like

I think it might be better to display something like "Hello" + " " + "World". When the user adds a new expression, he can just select this expression to overwrite it.
I agree with @MartinDDDD 's idea: the user hasn’t done anything yet, why does something go wrong :smiley:

2 Likes

the user hasn’t done anything yet, why does something go wrong

I totally see your point and this summarizes it pretty well. The dialog should open with a state that asks for user interaction and not in a state that says: “There is something wrong here”.
I don’t know yet if we will fix it by implementing @MartinDDDD’s behavior or devise another one.

Also, note that you can see the input table while writing your expression if you use the embedded dialogs in the Modern UI:

5 Likes

@bwilhelm , @MartinDDDD , @HaveF

What about an “On/Off” or “Active/Bypass” switch on each expression? That would be a pretty powerful addition that would allow us to trouble shoot, duplicate a node and then simply turn off the unnecessary expressions while keeping them in place for later modification, and it can be automatically switched to Inactive / Bypass when an expression is blank or only contains comments!

One of the most frustrating things about expression writing is that you can’t attempt to write a complex expression and finish it later because it will throw an error. The ability to bypass would allow us to work on those complex formulas over time without breaking the workflow. I would personally want the “Evaluate Rows” functionality to remain active, but perhaps change the text to “Inactive - Evaluate first 10 rows”.

We would of course need a strong visual reference in the UI to easily see the Active formulas vs inactive.

I am also adding a link into another thread where I also requested that the option to “filter” be built into the Expression node since these ideas are related somewhat.

4 Likes

Dear @MartinDDDD,

We create a ticket to not show initial error for empty expressions: AP-23623

2 Likes