Hello,
I am very new to KNIME and I have a simple question.
How to iterate through rows with unique values and perform some formula on them? For example, i have a dataset:
Fruit~ Amount, Price
apple 2 1$
apple 3 1$
banana 1 1.5$
apple 1 1$
banana 3 1.5$
apple 1 1$
strawberry 5 3$
strawberry 4 3$
banana 2 1.5$
I would like to iterate through each row of the āFruitā column and to calculate [Amount*Price] and save the result for three different fruit types in in three different tables.
How to tell KNIME that he needs to calculate [Amount*Price] only for bananas, or only for apples, or only for strawberries separately? Which iterator can i use here? I need to know how to do it with Loop iterator.
Im thinking something like: LOOP --> Math Formula --> save separate CSV.
a little recap on my problem, what if i do not want to save each time the result in a separate table, but instead i want to create ONE table (called [Result]) and constantly update it?
For example, 1) I calculate [AmountPrice] for babanas and put the results into a āResultā table, --> then, 2) I do the same for apples, [AmountPrice], and would like to UPDATE the āResultā table, meaning I want to add the rows of the apple multiplication results just right after banans multiplication results.
So that my table would look like:
[Result]
1.5$ ((bananas)
4.5$ (bananas)
3$
2$ (start adding apples results)
3$
1$
⦠etc
P.S: in the āResultsā table i donāt need what I wrote in the brackets, I just need the multiplication result.
well you can either close loop with Loop End node which will concatenate all the results and then use CSV Writer to write all results at once. Or you can use CSV Writer in a loop with append option checked. Both should work just fine