CSV reader - I need a string

Hello!
I have the following problem.
I can’t select String and then I have an error. What can I do?

 KNIME-Worker-2-CSV Reader 0:814 Node    Execute failed: The following row could not be converted to the specified KNIME types: [1616117334-53701, https://www.futureelectronics.com/search/?text=EDAC&selectedTab=products&mfrSearch=mfrName&q=EDAC:relevance:manufacturerName:EDAC&pageSize=100&page=0, 140-941-290, EDAC, [{"qty":"10,000"}], [{"price":"$0.0082"}], 30,000     Ready to Ship!, 12 Weeks, 2053, Reel, Min:?10,000, Mult. of:?10,000, data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==, Datasheet, https://files.edac.net/edac/content/140/140-941-290%20-%20EDAC%20E-MATE%20Connector%20Female%20Crimp%20Contact.pdf, 140-941-290, https://www.futureelectronics.com/p/interconnect--crimp-terminals/140-941-290-edac-4133980, [{"val":"12 Weeks"},{"val":"2053"},{"val":"Reel"}], [{"spec":"Lead Time"},{"spec":"Date Code"},{"spec":"Package"}]]
java.lang.RuntimeException: The following row could not be converted to the specified KNIME types: [1616117334-53701, https://www.futureelectronics.com/search/?text=EDAC&selectedTab=products&mfrSearch=mfrName&q=EDAC:relevance:manufacturerName:EDAC&pageSize=100&page=0, 140-941-290, EDAC, [{"qty":"10,000"}], [{"price":"$0.0082"}], 30,000     Ready to Ship!, 12 Weeks, 2053, Reel, Min:?10,000, Mult. of:?10,000, data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==, Datasheet, https://files.edac.net/edac/content/140/140-941-290%20-%20EDAC%20E-MATE%20Connector%20Female%20Crimp%20Contact.pdf, 140-941-290, https://www.futureelectronics.com/p/interconnect--crimp-terminals/140-941-290-edac-4133980, [{"val":"12 Weeks"},{"val":"2053"},{"val":"Reel"}], [{"spec":"Lead Time"},{"spec":"Date Code"},{"spec":"Package"}]]
        at org.knime.filehandling.core.node.table.reader.type.mapping.DefaultTypeMapper.map(DefaultTypeMapper.java:108)
        at org.knime.filehandling.core.node.table.reader.GenericDefaultIndividualTableReader.toRow(GenericDefaultIndividualTableReader.java:104)
        at org.knime.filehandling.core.node.table.reader.GenericDefaultIndividualTableReader.fillOutputWithProgress(GenericDefaultIndividualTableReader.java:138)
        at org.knime.filehandling.core.node.table.reader.GenericDefaultIndividualTableReader.fillOutput(GenericDefaultIndividualTableReader.java:112)
        at org.knime.filehandling.core.node.table.reader.GenericDefaultMultiTableRead.fillRowOutput(GenericDefaultMultiTableRead.java:131)
        at org.knime.filehandling.core.node.table.reader.GenericMultiTableReader.fillRowOutput(GenericMultiTableReader.java:90)
        at org.knime.filehandling.core.node.table.reader.GenericMultiTableReader.readTable(GenericMultiTableReader.java:176)
        at org.knime.filehandling.core.node.table.reader.TableReaderNodeModel.execute(TableReaderNodeModel.java:154)
        at org.knime.core.node.NodeModel.executeModel(NodeModel.java:576)
        at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1245)
        at org.knime.core.node.Node.execute(Node.java:1025)
        at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:558)
        at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
        at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:201)
        at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:117)
        at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:334)
        at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:210)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
        at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)
Caused by: java.lang.NumberFormatException: For input string: "30,000     Ready to Ship!"

Hi @a.formella

On the “Advanced Settings” tab of CSV Reader can you untick “Limit data rows scanned”., or increase it until it finds a record containing a string?

Does that help?

2 Likes

When I am having troubles with the CSV Reader I use the File Reader instead. That usually solves most of the issues I have.

Hello! Thank you for your replay.
File reader seems not to be so smart to recognize local path.

Preview works but the execution not:
WARN File Reader 4:874 Errors loading flow variables into node : Coding issue: Cannot create URL of data file from 'W:\by_source*****************4\3830168.csv' in filereader config

“Limit data rows scanned” - yes it works, but file path is controlled with a variable, file is very big and available on network share, and I know it would contain a string in “stock” column, so it is very slow solution for me.

Finally I changed all occurrences in all workflows using… notepad++ (settings.xml):

<config key="column_spec_6">
<entry key="column_name" type="xstring" value="stock"/>
(...)
<config key="column_type">
<entry key="cell_class" type="xstring" value="org.knime.core.data.def.StringCell"/>
</config>
(...)
</config>

if I were to imagine a perfect world, this option would be part of it :slight_smile:

Hello @a.formella,

this option is already on the list. Someone will update this topic once perfect world is a step closer :wink:

Br,
Ivan

1 Like

Hi @a.formella , I had a play with the File Reader and found the same as you that it doesn’t play nicely if the file path is a network share. I put together a small workflow to demonstrate this, and how to circumvent the issue rather than having to edit your xml files directly.

KNIME_Network_path_to_file_reader.knwf (18.3 KB)
Having arrived at that solution, I wrapped the central functionality into a component, as I could see that I might have a similar issue at some point in the future. All you would then have to do is pass the flow variable name that contains your network path, and the component would return a new flow variable containing the URL. The flow variable would be the same name but with the suffix _URI.

If you want to give the component a try, I’ve uploaded it to the hub at https://hub.knime.com/takbb/spaces/Public/latest/String%20File%20Location%20to%20URL
And there is a demo workflow based on the one I’ve uploaded here at:
https://hub.knime.com/takbb/spaces/Public/latest/KNIME%20Test%20String%20File%20Location%20to%20URL%20component

6 Likes

Hello @a.formella,

with KNIME version 4.4.0 you are a step closer to a perfect world (there is String option) :sweat_smile:

Br,
Ivan

4 Likes

Yes!
Thank you very much! :slight_smile:

image

1 Like

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