Excel Reader Column Name Row Flow Variables

Hello there,

I’m trying to take over the column names over flow variables. I selcted the right flow variables and the row with the column names disappears within the process but Knime doesn’t adopt the column names. Instead of the wished column names the columns are named with the alphabet. So column 1 is “A”, column 2 is “B” etc. Is this a bug that the column names aren’t adopted or do I have to set some special settings in the Excel Reader node?

I attached screenshots of the flow variable setting of the Excel Reader and the general workflow.


Hello @andi_braun96,

and welcome to KNIME Community!

Don’t think it’s a bug rather some configuration tweaks are needed. Are you using flow variables cause column headers are not always in same row? But how do you determine in which row are they? Can you shows us configuration of your Excel Reader?

Br,
Ivan

1 Like

Hello @ipazin,

thanks for responding.

The column headers aren’t always in the same row.
We get different layouts of invoices of the customers. Only one customer has the column header in row 7 and every other customer in the first row.
I create a string with the “String Input Node” and check with the “Rule Engine Variable Node” if it’s the special one or not and write the row number into the new veriable of this rule engine. After execution the right row number is written into the variable depending which customer it is.

I tried quite everything what came into my mind to fix my problem. Even with different configurations of the Excel Reader.

Sometimes it works. But after execution for another time I have the same problem again and I don’t understand why…
Even the row with the column names disappears and the column names are still from A to “Z”



Hello @andi_braun96,

seems like some configuration tweak is needed as I have just tried it and works as expected. Here is example. Can you check it to see where is configuration/design difference?
2021_08_20_ExcelReaderWithColumnRowNumber.knwf (32.0 KB)

Or even better provide 2 Excel files with different column header row. Dummy data works just fine :wink:

Br,
Ivan

2 Likes

Hello @ipazin,

I compared our settings in the Excel Reader and they were identical.

Then I compared our Rule Engines and realised that I used “MATCHES” instead of “=”. I tried this in my worklflow and it works now!

Thank you for helping me! :slight_smile:

Br,
Andreas

1 Like

Hello @andi_braun96,

you are welcome. Glad you figured it out! Indeed MATCHES operator is for regular expression so won’t work with number values. In general you can use Step Loop Execution option from loop end nodes in order to debug your flow :wink:

Br,
Ivan

2 Likes

I have mentioned this on different threads, and I’ll mention it again: There seems to be a misunderstanding that matches is used for comparing strings and = is used for comparing numbers. I had a few colleagues who believed so, and I’ve seen it in various threads in the forum. I’m just not sure why there is that misunderstanding - Just trying to see what is the reason for this misunderstanding to try to get rid of that misunderstanding.

Perhaps the Description about the = could mention more details about the fact that it can compare strings too, and could include some examples where strings are being compared:
image

But as @ipazin said, matches if for comparing regular expressions, and = can be used to compare both strings and numbers.

3 Likes

@bruno29a in my opinion it’s a little bit confusing because it’s in the middle of the comparisons of bigger and smaller signs. In this case I thought that this operator is only used for numbers and MACHTES for strings, as you already said.

It would be great if the description is added with which kind of data can be used with every sign and a little example.

If I think about all kinds of programming languages the “=” is used for every kind of data. But I didn’t think that far :smiley:

Br,
Andreas

1 Like

Hi @andi_braun96 , thank you so much for this information, that is very helpful.

In theory, even with the greater and smaller operators, you can still compare strings - think of it as an alphabetical sort order. Based on that logic, “a” < “b”. That is why also in some cases in date strings, if your date is in the format of year-month-day, you can compare them directly as string without having to compare to dates.

See example below:
image

With the following Rule Engine:

It produces this result:
image

That’s correct, and that’s where my experience kicked in, and that would also include the greater than and smaller than operators (you can try it in other programming languages).

But I can see where the confusion can be, and I think better descriptions would definitely help.

2 Likes

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