Using Loop Nodes to Automate Operations

Hi Everyone!

I’m trying to use loops to automate repetitive tasks on my workflows, but I’m still not confident enough with these nodes.

I will explain my situation so maybe you can help me out.

First of all, I have two datasets:

  • Dataset 1: a Google Ads export table with sales performance from various ad campaigns; each campaign contains ads to a specific product set, different campaigns can refer to the same product set
  • Dataset 2: a CRM export table with sales data from each product set and the campaign that generated that sale
    My final objective is to join the two tables so that I have both Google Ads and CRM results in the same file. That is the easy part, though.

Problems arise when the CRM files includes results for some product set without a campaign. My manager asked me to take the results from these product sets and sum them to the best performing campaign for each set.

Example: Product-Set_1 has generated 3 sales without a campaign, so I need to sum those 3 sales to the results of the best performing campaign for that product set.

The problem is that the quantity of product sets generating campaign-less sales will surely vary every time I will have to make this report. So i wanted to try and use a loop to automate the filtering the math operations without having to do it by hand every time.

Can somebody help me?

1 Like

Hi Giacomo,

It would be great if you could share an example dataset with us.
In the meantime, I’ve created a synthetic dataset for this purpose.

Please feel free to check out the data and the corresponding KNIME workflow—I believe this gives us a solid starting point.

Best regards,

Alpay

Google Ad.knwf (18.4 KB)
KNIME_Loop_Campaign_Matching_Example.xlsx (6.2 KB)

2 Likes

Hi Alpay,

First of all, thank you!

I created this example workflow to better explain the situation:

My objective is summing the values shown in the GrouBy node to the top seller campaign for the corresponding product set in the Google Ads Export.

Notice that every time I update the CRM export i might find different product sets that generated sales outside of a campaign. In this case these are prod. sets 1, 2 and 5, but next time might be 2, 3 and 4.

My initial idea was to filter the GroupBy node and the Google Ads export for every product set, but that is way to long of a process and it requires to be edited every time I update my dataset. That’s why I wanted to try and use loops to automate this process.

Loop Project.knwf (79.3 KB)

2 Likes

Hi,

I’ve managed to put together a solution that I believe addresses what you’re looking for:

  1. Loops through product sets
  2. Adds “no campaign” sales to the best performing campaign within each product set
  3. If “no campaign” sales are zero, all campaign-based sales are still included via a left join
  4. The final result is shown at the end of the loop
  5. it is fully dynamic, if your campaigns or sales or product sets change, it adapts itself.

I hope this helps! If anything is unclear or not quite right, feel free to ask.

Best regards,
Alpay Zeybek

Loop Project.knwf (34.9 KB)

3 Likes

I think this might be it!

I will test it out and let you know, thank you very much!

1 Like