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.
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?
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”
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
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
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:
But as @ipazin said, matches if for comparing regular expressions, and = can be used to compare both strings and numbers.
@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
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.