arrayLength() on collection of DataCell

Hello,
Extract Table Spec can create a collection of possible values and this is a collection of DataCell. But in Column Expressions, arrayLength() can’t evaluate : “An error occurred during the execution of the script: Error occurred during column access of column ‘Possible Values’: Cannot invoke “org.knime.core.data.convert.java.DataCellToJavaConverterFactory.getDestinationType()” because “elementConverterFactory” is null”

GroupBy is sufficient of course but it will be useful to have this possibility directly after Extract Table Spec.
May I miss something ?
Best regard,
Joel

Hello @JPollet,

don’t think you are missing anything. Seems array functions from Column Expressions node can not work with collections of type DataCell which is what Extract Table Spec node outputs. But you can use Java Snippet (simple) node to convert your DataCell collection to String collection type. Simply use

return $Possible Values$;

and check string and array for return types. Then you’ll be able to use array functions from Column Expressions node.

Additionally you can use java to get array length right away. Use
return $Possible Values$.length;

and check integer for return type.

Hope this helps!

Br,
Ivan

1 Like

Thanks a lot for the hint ! I have tried .length in column expression too but javascript don’t understand DataCell type too.
Best regards,
Joël

1 Like

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