Obtaining the length of several columns

Hi team,
I’m trying to obtain the length of several columns. I’m using the string manipulation multinode but I get errors.

If i select only 1 column, the same length is repeated on each column…

@yoshiki3 welcome back to the KNIME Forum. I do not think you can combine the two functions with AND. Question is what you want to do.

The syntax for the multi column would use a placeholder for the CURRENTCOLUMN (on top of the column list). If you use a specific column and replace the values in all columns with that it will do exactly this.

Have you used trim() to remove unwanted blanks? Maybe you can provide a sample that show the problem.

I used len function in excel and I obtained something like this, the length for each column. I wondered if I could so something like this in Knime. I cannot trim it because I need to know the actual length of the files produced by mainframe.

@yoshiki3 maybe you can give an example to work on. Do you want the maximum length per column or the individual length of each cell?

1 Like

My data looks something like this, data edited for privacy.

I’d like to get the length for each column. Let’s say I want to get the length for columns A, B, C, D, E, F. The length of each cell in the same column will be the same. A1, A2, A3, A4 will have the same length. B1, B2, B3, B4 will have the same length… Thx

@yoshiki3 I still do not understand what column length does mean an a screenshot is nothing to work on

1 Like

To get Excel like output.

  1. Filter one line from original table
  2. Use Column Expression to get length of the columns as string: text(length()). Check replace option.
  3. Use Concatenate node to concatenate original table with output of Column Expression.
1 Like
|O'REILLY AUTO PARTS 1006      |                              |2601 82ND STREET              |                              |LUBBOCK                       |TX             |79423-2247|(806) 745-3342      |303            |100            |N|Y|B|Y| | |                              |N|                              |Y|  |???|000000000|

Let’s say the length of each cell (as each cell on that column contains the same length,.

@yoshiki3 in your screenshot the rows in the column (s) do not have the same length. Is the rest filled with blanks?

each column has a different length. The blanks need to be counted, though. Cells are originally separated using a pipe operator and I’m trying to check if the length matches a mapping document I got.

length works on string columns. Are you sure your columns have the right datatype (and you replace missing entries)

1 Like

@yoshiki3 my suggestion would be to start with the original file and maybe provide that as an example if you are sure every row of a column always has the same length. But that could also a thing to be checked.

I didn’t quite understand. Are you asking to create new columns, one column with the result for each analyzed column?

For example:
(pipe is another column)

A | | B | LENGHT A | LENGTH B | …


Do you want to join the result of the LENGTH FUNCTION into the text in the same column itens ? (Replace with join expression)

For example:

A1 = product (7)
A2 = product1 (8)

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