Information Extraction Loop

I have the a knime table like following

product name : paper clips, price : 2.34
product name : ruler, price : 2.55
product name : calculator, price : 10.23
product name : pencil, price : 4.23
product name : glue, price : 3.13

I try to extraction relevant information via a loop, put the extracted information. into variables like following for further processing

For example :

after data extraction,

"product" variable should contains: paper clips, ruler, calculator, pencil, glue

"price" variable should contains: 2.34, 2.55, 10.23, 4.23, 3.13

However the knime loop doesn't work,  can anyone advise what's wrong in the loop ? (attached the knime work flow)

 

 

 

 

 

You got yourself into a very complicated way of addressing this task.

I would first do the extraction of product name and price using a Regex Split node and only then convert to Flow Variable for further processing. See the attached workflow.

Cheers,
Marco.

Hi,

Thanks.

Now I have a number of source files.

So, I need to read the file as knime table one by one, extract data by regex, then append the knime table rows together, I perform in loop but doesn't work.

Any suggestions ?

Sorry, "doesn't work" is too generic as a problem to be able to give any sound suggestion.

What exactly doesn't work? Which errors do you get? How does your workflow look like? If there is a loop, did you try to execute it step-by-step to check if the inner portion works properly?

Cheers,
Marco.

Hi,

 

here is a example how you can read many files in a loop

https://www.knime.org/nodeguide/control-structures/loops/example-for-reading-a-list-of-files

Best regards, Iris

Hi ,

Thanks a lot.

Currently the situation for each iteration in the loop :

1) extract relevant data  (i.e. product and price information)

2) append rows extracted from step 1 together for each iteration

Then, after the loop finish, Im able to get full set of rows in one knime table for insertion to database

But I can't achieve (2).

Attached is the knime workflow and the files for looping.

Appreciate if anyone can suggest how to do it 

 

Hi,

your problem is that you are using a Variable Loop and this kind of loop (see description) does not aggregate the results at the Loop End node.

You need to slightly change your strategy by using a Chunk Loop to go row by row on your file table and convert a row to variable only inside the loop. In this way you can aggregate the results from multiple files.

See the picture below where your original loop is at the top and the new one at the bottom.

Cheers,
Marco.

Ungroup