I have to create a new calculated column based on a formula applied to a column from my input table. The formula is not fixed; the user specifies this formula at the execution time. I thought I could do this with a column expressions node but I was unsuccessful.
Do you have an idea on how I could do this?
you can handle this by using a component:
In the string configuration you have to write the exact formula to use and pass it by a flow variable to the column expression node, like this:
By double clicking on the component, this popup come out, where you write the formula:
Hope it helps.
Thanks a lot Luca, I was using my variable in the wrong place.
Great, it works,
Do you know if there is a node that checks if the formula is correct? Right now, if it is not the case, I just get a warning.
You can maybe use a try/catch node:
but i get always an error on expression node whenever i intentionally put synthax errors in the string widget… someone can help pls?
well String Configuration node has Regular Expression field so one can write regex to validate given expression.
not a regex expert but something like this if you only want expression to be about adding two numbers:
More complex expressions obviously lead to more complex regex…
but you can’t really check if the syntax is correct or not.
So there isn’t a way to bypass a node if something wrote in a string widget is wrong?
I can’t figure out
For checking regular expressions on the fly, you might try out the RegEx Extractor node from the Palladian extension.
i don’t think that might be the solution of this usecase.
i’ll want to simply bypass a node that has been put “down” because a string configurator node is injecting a wrong formula. Can some try/catch node resolve this issue?
I understand but that is not possible with Try/Catch nodes cause they catch errors during execution while Column Expressions throws error during configuration in this case.
Exactly. But maybe i’ve found a way to bypass a configuration error of that node.
Look at this:
And this is the nested component, where column expression is:
So when i write this in the master component:
i can successfully bypass the node and getting an error both as breakpoint and as custom message from the table.
Looking from a use case perspective. If a user inputs wrong expression workflow can continue to execute but results are not going to be correct. This means user has to run workflow again and again until expression is right. So if I’m designer or user running workflow I would prefer to throw/have syntax error right away and not wait till execution is done, then check results and go back to same workflow…
yep, that’s true. only testing/prototyping here
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.