Looping problem

Hi,

I would like to filter a column, which contains 5 values: 1, 2, 3, 4, 5 multiple times. This column is part of a data sheet.
I attempt to do these steps in a loop:

  1. filter a pattern from 1 to 5
  2. count the rows which contains the sepecific value
  3. rename count column (spec name) for e.g. one, two, tree, four, five
  4. table row to variable

Sending email once containing the statistics.

Where can I put a loop node? What type of looping node can solve this issue?

Thank you very much for your help!

Best, D.

Hi @kora

I don’t think you need a loop structure. You can use the Value Counter node to count the occurrences of the values in a specific column.


gr. Hans

1 Like

Hi Hans,

I need to do these stpes more times in case of other type of variables.
e g. data1, data2, data3…and I need these special name as a variable.

Thank you so much for your help. :slight_smile:

Hi @kora,

welcome to KNIME Community!

You mean you need loop cause column names might change or? Can you share some (dummy) input data and desired email output to avoid guessing what you need :wink:

Br,
Ivan

Hi @ipazin,

So in the meantime my questin has been changed, because I found another way to solve this iteration issue. :slight_smile:

Issue:
I have a data.xlsx table with important_event column.
I would like to send a statistics per email about the sum of important_event type.

My question is:
How can I refer a variable if it does not exist in the table?
I would like to refer to the 4th type assign to a 0 value in the email html file.
Is there any solution?

Regards, kora

input table:


email:

data.xlsx (8.8 KB)

Hi @ipazin,

I would like to add the original issue, because the last one, which I mentined yesterday, does not seem to be solvable.

So the original question is:
How can I count and save these sums in diferent variables, when I have e.g. 5 types of itemes in a column.
These wf contains repeted steps:

  • row filter
  • value counter
  • column rename
  • table row to variable

Originally I would like to find a looping solution for this part.

Thank you very much!

This would be an option, but I am interested in an easier, smarter solution:

Hi @kora

Instead of a RowFilter you can use a GroupLoop. See this workflow looping_problem.knwf (29.6 KB)


gr. Hans

1 Like

Hi @HansS,

Your solution proposal is a quite perfect, thank you very much. :slight_smile:

It works well, if the column contains all of the 5 types, but if it does not, I will only have the variables, which types are in the column currently.

My goal is to have always all the five variables refering to the five types, hence I would like to refer them constantly in the email (html).

Thank you so much again!

Best regards,
kora

1 Like

Hi @kora

In that case, I added a table with all possible values, that is used to check if they are available in the dataset. See looping_problem.knwf (68.2 KB)


gr. Hans

3 Likes

Hi @HansS,

Thank you for the fast help. Your last suggestion works well.

Best regasds,
kora

1 Like

Hello @kora,

don’t like it but seems like table with all possible values and then join is needed in this case (anyone with idea how to improve it?) but why not doing a full outer join and then use Pivoting node?
looping_problem_ipazin.knwf (86.9 KB)

Br,
Ivan

2 Likes

tsja, much more efficient @ipazin +1
gr. Hans

3 Likes

Hi @ipazin,

Pivoting is a much easier solution, I also like this workflow. :slight_smile:
Thank you! :slight_smile:

Best regards,
kora

1 Like

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