Channable merge with(out) loop

If you work with Channable, you may sometimes want to import data from a source that uses unique identifiers which are not yet available in your main import. For example, think of product_type, which you fill in your rules based on maincategory and category, but is not yet available in your main import.

If you want to be able to import the items, you must first ensure that the unique identifier is added somewhere in your import, by combining it using an existing unique identifier.

Merge with loop

A commonly used solution for this is to create a loop. This allows you to create an output feed (usually CSV or XML) in Channable, where you add rules to generate your desired unique identifier. You then re-import the output of this feed back into the same project, so that the values are already available from the import.

Let’s look at an example: Suppose you have an import feed that consists of two columns: Product_type and Label, based on a product_type report from Google Merchant Center. Here, Product_type is the unique identifier, and Label is the value you want to add in Channable to all items with a specific product_type.

In your Google Shopping feed or Content API, you already have a rule set up to populate product_type that looks like this:

To make the result of this rule available on the import side, you can create a separate CSV feed in which you copy this rule and then export it again with an existing unique identifier, such as:

Next, you set up an import where you import this feed back into the same project, thereby creating a loop:

The result is that all items are now provided with a value for the product_type field, based on their GTIN:

Once product_type is populated on the import side, you can then apply the other import and have it merge based on this field:

As a result, the items in your project are now all provided with a value for the product_type field and the corresponding label.

But when should I merge without a loop?

So far, so good, you might think. But there’s an important drawback to this "merge with loop" method. What happens when you refresh feeds in Channable?

  1. First, all imports are retrieved.
  2. Next, all rules are executed.
  3. Finally, the output feeds are refreshed.

So, if you apply a loop, it takes two runs before the result is visible in your project and output feeds. Only when the output feeds are refreshed will your loop contain items with their loop value, which are then imported in the next run. As a result, a loop is always one run behind.

Suppose you apply product_type via a loop and you have a Core Pro license, meaning your feed refreshes every hour. In this case, it’s usually not a big issue, as the delay is just one hour. Once the value is applied, it doesn’t change again until you adjust the rules for it.

However, if instead of a static value like product_type, you use a loop with a dynamic value, this delay can cause your items to consistently lag by an hour and potentially perform less effectively as a result.

And if you have a Core Standard license and Channable only refreshes once a day, it already takes a day by default for new items to be assigned the loop value. During events like Black Friday, such a delay means you’re effectively a day late before your new labels are processed.

Merge without loop

This is why there are cases where you’d prefer not to use a loop but instead directly link the data to the correct items.

The easiest solution to achieve this is by adjusting your main import via the backend and adding a field that directly fills in the correct value for product_type, making the loop unnecessary.

If that’s not an option, there is another method that allows the data to be combined without a loop, although it is a bit more complex.

Step 1: Add the import as new items

Instead of combining on a specific field, you add the new import as new items. This is also the biggest drawback of this method, as those extra items still count towards your license limit, whereas combining does not. So first consider whether this method is truly necessary and, if so, whether you want to include all values in the additional import.

For example, if you have an import with product_type and label, where label always contains one of three fixed values (e.g., Zombies/Heroes/Villains), you might choose to import only Villains and Heroes and then use a Channable rule to assign the remaining items the value Zombies.

Step 2: Apply the rule to populate product_type

Just as you would with a loop, first set up the rule (preferably in your Hygiene Master rules, see 5 Channable Master rule groups to rule them all) that populates the identifier with the correct value so that it matches the additional import.

The only difference is that you need to add an IF statement to exclude the newly imported items. The simplest way is to filter on {new unique identifier} = empty, so in this case, IF {product_type} = empty.

Step 3: Duplicate all your regular items

Since we want to combine data based on product_type, a field that can contain multiple items, it’s necessary to first duplicate all regular items, so each regular item also has a duplicate, or an alt-ID. We can then work with these duplicates and eventually group and merge the results back with the original items.

See Duplicate items rule for more information on creating duplicates. Be sure to add an IF statement based on the identifier you’re using to create duplicates, such as "IF {ID} isn’t empty," so that items from your additional import are excluded here.

Step 4: Merge the duplicates and new import items

You can then merge the duplicates and the items from your new import using a rule like this:

In your IF statement, ensure that regular items are excluded, so that the duplicates and new import items are merged into a single item per product_type, with a list value containing all (alt-)IDs and the correct value for the label.

Step 5: Split by (alt-)ID

We need to get these values back into our regular items, so we first need to split these new values by the ID field (which you could technically also do in the previous rule).

This ensures that you end up with all your regular IDs and your alt-ID duplicates, each with the correct label value.

Step 6: Group by ID

You can then merge the alt-ID and regular ID by removing “-alt” from the duplicate ID and grouping by ID, ensuring that the label is included as well.

If all steps have been correctly executed, the result is that only the regular items remain, neatly assigned with the correct product_type value and the corresponding label, without unintentionally altering other fields.

Merge without loop Bonus Tip 1:

You can apply this method multiple times in succession. So, if you also have an additional import based on item_group_id, you can apply the same steps again after these rules to combine that data with your regular items as well.

Merge without loop Bonus Tip 2:

This method is quite complex and involves splitting and grouping, so it’s recommended not to apply it directly in your live Hygiene Master rules. Instead, first make a copy of your master rules, apply the above steps in that copy, and test it first.

This way, if something goes wrong with these rules, it won’t immediately affect all your feeds. You’ll have time to ensure everything works as it should before going “live.”