Math Formula Node

Hello everyone,
I am currently facing this problem, which might be very simple to solve…

Why can’t I use the Math Formula node?

Thanks in advance!

Does the file that you’re importing have any numeric columns? If so, has KNIME recognized them as numeric columns? In your renaming node, have you altered the column types?

The error message in your first screenshot is self-explanatory. Once you enter an expression, the view on the Flow Variables tab will update and allow you to set up various flow variables.

5 Likes

Hi @elsamuel ,

thank you for your quick respnse. Yes, i have numeric columns in my Input file. In the columne rename node i didn’t change the type.

Hi @Arock1980, I think @elsamuel might be right that you don’t actually have data appearing as numeric arriving at the Math Formula node, even if your data in Excel appears to be numeric. Maybe it looks numeric, but I’d say it is possibly being interpreted as a String by Knime for some reason.

For example, in your screenshot, we can see that the column “Overdue in Days”, which sounds like it would be a numeric field is actually a String, as it has an “S” next to it.

image

In the “preview” panel of your Excel Reader, can you check the data types shown to ensure that at least one of them is coming through as a non-String,

e.g. (example from a dummy spreadsheet on my PC)
image

3 Likes

Hi @takbb , my input table looks like this…

@takbb beside that, can you please help me to to finde a simple way to eleminate teh “#” signs and change the columm " discount percentage payment" " into percent like this…

3.000 → 3% or 0,03

2021-04-18 21_24_12-Renamed_Retyped table - 7_3 - Column Rename

As I suspected earlier, none of your columns are in a numeric format. You need to fix this, either using the appropriate settings in the Excel Reader node, or by making the appropriate selections in the Column Rename node.

As for your second question about the # signs and percentages, this all depends on how your data is formatted to begin with and what you plan on doing with them later in the workflow.

Things would be much easier for us if you shared your workflow along with some data. This piecemeal approach is inefficient.

3 Likes

@ARock1980, if you are able to post your workflow here, with sample (non confidential) data it would, as @elsamuel said, make it quicker and easier to assist as otherwise we are working slightly blind.

But that said, without seeing your data, for the # removal one thing you could do something like this

(Replace my Table Creator with your Excel Reader)

The rule engine changes “#” to an empty string and the String to number converts the column to a Double. This is then divided by 100 in the Math Formula node. That leaves you with lots of missing values where the # symbol was. That may be what you want, or alternatively you can use Missing Value to convert these to a fixed value (0)

I’ve attached this as a demo workflow.
KNIME_Converting_Strings_to_Numbers.knwf (18.3 KB)

5 Likes

Hi @ARock1980 , when we ask if there is any numeric column, we’re asking if the type of the column is numeric. Having numeric values in the column does not necessarily mean that the column is of type numeric :slight_smile:

As shown by your screenshots and highlighted by @takbb , these [S] and [I] at the beginning of the column names indicates the column type ([S] for String, [I] for Integer, etc).

So, even if you removed the “#” sign in your example, it would still not work. You need to change the values to numeric, but also change the column type.

To change the column type, you can either change it in the Excel Reader node itself (right click on the header of a column and change the type) or use what @takbb is using in his workflow (String to Number).

And @elsamuel 's guess was correct about the fact that you did not have any columns of numeric type, which was the issue.

2 Likes

Hi @elsamuel @takbb @bruno29a ,

thank you for your helpful contributions and the workflow. I will gladly comply with the instruction to provide a data example :slight_smile:

You have supported me very much in my first steps :slight_smile:

1 Like

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