Loop & Rule engine between different column

Hi guys, I need a little help on a loop with a rule engine node.
Actually I have this tab

ID 202101 202102 202101 (1) 202102 (1) 202101 (2) 202102 (2)
1 1 3 3
2 3 6
3 2 4
4 1 1 1
5 4 4 1
6 7 6

And i need something like this

ID Jan Feb Tot
1 1 3 4
2 3 6 9
3 4 2 6
4 1 1 2
5 4 1 5
6 6 7 13

Each month the loop will need to add the additional month (202103 and so on.).
Actually I have different rule engine nodes, one for each month but it is becoming time consuming,

Do you have any help?

Can you upload your workflow so that we can see what’s going on inside?
It’s unclear to me how you’re going from your initial table to the final one.

1 Like

Hello @Reader91,

if I got it right you can use Column Aggregator node with wildcard selection (202101* for January, 202102* for February…) to define column you want to aggregate. From your example seems First as aggregation method with missing values excluded will do the trick. In case you have only two months I would avoid loop and simply use two Column Aggregator nodes while in case there are more months looping can be done. Do you know how many months you have? Maybe fixed number of months?

Br,
Ivan

1 Like

Hi guys, thanks for your reply.

This is the actual flow I’m using with different rule engine, one for each month.

Workflow.knwf (81.1 KB)

Every month I will create a new rule engine node to add the last month, in this case May.

Hi @Reader91

I have put together the following attached flow, but it uses neither the loops nor Rule Engine. It should perform the functions you require though, and it should not require any editing for each month provided that you continue to include new columns in the input table in the same form that you are currently doing.

The top of this flow contains your original flow for the purposes of comparing (testing) the new flow.

The section in the box to the right is only used for testing.

Workflow- ‘Loop and rule engine’ but without Loop, or Rule Engine!.knwf (174.2 KB)

1 Like

Hello @Reader91,

this is what I had on my mind:

AggregationInALoop

Help table with new column names and wildcard patterns which are then used to parameterize Column Aggregator node inside variable loop. For new month simply add another row to Table Creator node. This could be automated as well if needed…

Here is workflow example:
Workflow_ipazin.knwf (183.1 KB)

Br,
Ivan

1 Like

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