I have a router with 17 filters, but data is only following the first path it matches

Hi all. I have a question about structuring scenarios. I’ve included below a screenshot of what I’m trying to achieve.

We’re monitoring a Google sheet that holds inventory numbers.
There are 17 products in the sheet.
If the inventory figure changes, the updated figure should be sent to the relevant Shopify product.

Within the Google sheet inventory figures are stored in cells, e.g.:
Product #1 (cell G1)
Product #2 (cell G2)
Product #3 (cell G3)
Product #4 (cell G4)
etc…

After the router, we have filters set up on every path. E.g.,
if the cell range is equal to G2 then allow data to pass to Shopify product #2.
if the cell range is equal to G3 then allow data to pass to Shopify product #3.
etc.

This works, but only for updating inventory against 1 Shopify product. Essentially, data is only flowing to the first path it matches in the filter and then Make is completing the scenario.

If inventory figures change for all 17 products in the Google sheet, Make is seeing the changes but completing the scenario via the first filter match only. So only 1 out of 17 products update.

I understand the logic behind why it’s doing this, but I’m unsure what the best solution is.
I can create 17 separate scenarios but this seems excessive — or is this the best way?
Is there a way that this can be handled within 1 scenario?
I could schedule the scenario to run every 15 minutes, but assuming 17 products need updating, that’s going to take 17*15 = 255 minutes or 4-5 hours to complete the updates!

Hopefully this makes sense. I’d appreciate any input here as I’m a bit of Make newbie.

I’m still fairly new to Make, but I believe I know the answer to this one.

When you set up the trigger, there should be a field named Limit with a description of “The maximum number of results to be worked with during one execution cycle.” If you set that number to 17, it should run through all 17 instances.

1 Like

Thank you for this! It looks like this one is a bit different though. The sheets integration is using a webhook to monitor changes. There aren’t any settings for the maximum number of results to be worked with during one execution cycle (see the screenshot).
That said, thanks for sharing as this is really helpful info for other stuff I’m working on.

Ahhh true! Webhooks do not have that setting as you pointed out. Sorry about that.

Since it sounds like the filters are probably causing the issue, I’m wondering if they’re really necessary here. While I’m not familiar with Shopify modules specifically, is there another module you could add before the Shopify update that would match each data set with its relevant Shopify product? (I do a Google Sheets Search Rows in one of my own scenarios that cycles through multiple returned data sets, determines which row it matches, makes the change, and then goes onto the next data set.) So I’m thinking logic like that, instead of the filters, might work better here. (Even an array on a 2nd hidden sheet that does the matching of cell to Shopify product.)

Hopefully someone else will come along that’s more familiar with using Shopify, but if not, perhaps my suggestions will get you thinking down a different path. :slight_smile:

@DK1 So basically when an update happens, it will only send 1 “collection” of data basically for that specific update because you are using a webhook as trigger.
So basically, with every update that happens (it could be 1 product, 5 or 17) it would run the update trigger and flow through the scenario using the correct path. Does that make sense?

If you want to run an update on everything when 1 product changes, I would follow the steps as @CheriePie says;

  • Trigger says the same, it updates and starts the scenario
  • Next module is a “Search Rows” which grabs all data and output multiple collections
  • Then with this data it will follow the paths and update everything.

Hope this makes sense. Let me know if you got more questions.

Hey guys. I really appreciate your help with this. I’m getting closer, but something odd is happening which I can’t figure out. I’ve followed your advice (I think!) and placed gsheet “Search Rows” modules after the router. Like this…

I’ve deleted the filters on the Shopify path and instead added a filter within each of the “Search Rows” modules instead. Here’s an example:

The above screenshot shows a filter based on column F, searching for a match with the following text “9.0m x 14m” which is a particular product size.
Here’s an example of the data in the Gsheet. In this example, we get a match with “9.0m x 14m” on F19.

Finally, on each Shopify module we have a simple expression that sets the quantity available to 100 if the text in column G matches “add to basket”, otherwise it will set the available quantity to 0 if the text states “Email me when back in stock”. (100 is an arbitrary number by the way — all we’re trying to achieve is to enable the product if available, or disable the product to stop it selling when it’s not available)

I’ve run some tests and YES all inventory is now updating. But it’s all updating with the same number (either 0 or 100).
Using the above example, let’s say I change G19 to “Email me when back in stock”. This should set the inventory for the size “9.0m x 14m” to 0. All other lines in column G state “Add to basket” which means they should be set to 100.
When I run the scenario. All the inventory in Shopify now updates to 0, for all 17 sizes, instead of just the “9.0m x 14m” size.

Hopefully, some of this makes sense!? I’m not sure what I’m doing wrong here. Any input would be greatly received.

I’m getting the feeling that the router is what’s causing the problem. Can you try creating a completely new scenario (you can leave this one intact to return back to) with all the same modules EXCEPT leave out the Router module. Instead of having 17 different Shopify modules all doing basically the same thing, you would make a single Shopify module that’s more generic, i.e. it can be applied to ALL the data you wish to process.

I realize you may be using a separate module for each so that you can specify the Inventory Item ID, but using the switch function could help consolidate that into a single module. Here’s a great example of the switch function in use. It’s down towards the bottom but the whole article might give you some good insight.

Taking examples from some of my own scenarios, after the scenario is run and you check the history, is the previous module showing multiple operations like this?

Or is it all in a single array more like this? (notice the word array on the top line)

Or even just a collection? If one of the latter two as I assume, you could then use an Iterator module to split out the data in the array to multiple operations. Or if a collection, use the relevant mapping fields to cycle through each of the instances.

Definitely look to the data you’re pulling in from the previous module (I believe it’s the trigger itself) and see how Make is interpreting it. Maybe paste a screenshot of that from a previous run. From there, we may be able to give you a better idea how to reconstruct the scenario without the router and a single Shopify module.

1 Like

Hi again CheriePie! Thanks so much for the help.

Just quickly regarding the switch function and the Shopify module, the module references a specific product ID to update inventory for (see screengrab below). As such, I don’t believe you could use switch to consolidate 17 products into a single Shopify module.

Regarding your other points, I’m including below a screengrab of what I see within the module inspector for one of the gsheets ‘Search Rows’ modules in the history. It looks like a single array or collection?

I’ve included a screengrab below showing the history of the ‘Watch changes’ history but I don’t think this tells me much.

Screenshot 2023-06-15 at 08.03.42

I’m pretty sure I can make this work if I set up 17 different scenarios for each product, but it doesn’t seem very elegant, and in the interests of learning more I’m keen to figure out if there’s a better way!

@DK1 Hi!

I’ve had a quick look (I can be wrong depending on your use-case) but it seems you are overcomplicating the scenario. My thought would be to trigger on updates in the sheet and then have the product ID (from Shopify) in your sheet. You’d then search for the item in shopify with the id in your sheet and update the necessary data in that way.

Trigger on updated row → search for shopify item → update relevant fields in shopify item.

Let me know if this approach works or if there’s something I’m missing, feel free to reach out and I’ll take a look at your scenario :slight_smile:

2 Likes

Hi @Quintin_Pearson, thanks for the reply!

Do you mean like this… (simplified version with just a few products connected) ?

I tried this and have the same issue. It updates ALL the products with the same number (either 100 or 0) depending upon which change it sees first in the gsheet.

@DK1

In my example you’d search for the inventory item in Shopify with the id saved for that item in Google sheets, and then update only that item in the last step.

Feel free to send me something I can reach you with then I’ll be happy to take a look :smile:

2 Likes

I agree with @Quintin_Pearson 's recommendation above. In doing as he suggested, you’d also be taking out the router module as I was trying to do. And by triggering on an updated row instead of the entire sheet (something I neglected to consider), the entire scenario would run up to 17 separate times, once for each updated row.

So in this case, you’d only need 3 modules as above, and it’d run once for each updated row.

3 Likes

Thank you for all your input both. I am still struggling with this.

Here’s my gsheet

Which are the 3 modules you’re referring to here?

  • gsheet watch changes?
  • gsheet search for updated rows?
  • Shopify search for inventory items?
  • Shopify update an inventory level?

I can’t see how I can do this with just 3 modules? Currently I have it set up like this…

‘gsheet search for updated rows’ is searching for rows, column range A-CZ…

Then ‘Shopify search for inventory items’ is searching for inventory items that match with the inventory item IDs listed…

Then ‘Shopify update an inventory level’ is updating the inventory level for the variable ‘Inventory item ID’.

This isn’t working, unfortunately. I’m a bit stumped.

Hi @DK1,

Sorry haven’t caught up with the discussion over here, so I have a few questions regarding this,

So, Suppose you update a row in GSheet, right? It can be many or a single-row update, So, Flow-based on my assumptions will be something like this,

  1. Watch Changes Module(This will require you to install Make Extension in Gsheet and configure it accordingly)
  2. The Watch Changes module will always return in a single result, so basically even if you have updated multiple rows, it will always return a single row in each execution
  3. Afterwhich, You can use Search for Inventory Items, and over here you will pass the Inventory ID that you get from GSheet(This is optional though, as you can directly use the Update Inventory Item Module of Shopify and then basically pass the inventory ID from GSheet)
  4. Now, To wrap it up, You will then use Update Inventory Item Module with the same configuration that you have at the moment.

So, Not sure, exact use case for all these, but I think Watch Changes Module and then Update an Inventory Item is all you need to get this done.

2 Likes

Hi @Runcorn, thanks for your input.

Make Extension is installed and configured correctly. Changes are being detected.

Ok… so I think you’re just suggesting I do something like this…

But I really can’t see how this would work. The Shopify Update Inventory Item Module requires a specific inventory ID.

But if I’ve got three rows in my gsheet, there’s no way I can tell the inventory update module to update all three IDs

1 Like

In here,

Screenshot from 2023-06-20 18-10-06

Pass the Inventory Id that you are getting from Gsheet, like you are doing in Available field.

Something like this,

Since, you already have the Inventory ID, you can directly use that in Shopify Module.

1 Like

@DK1

@Runcorn is right,

Check the below SS. You would not update all 3 items at once. You would only update the item that was updated. You could map all values from the updated row into the update item without the search step. It’s not needed to update all rows if only one row has been updated.

like @Runcorn mentioned. there would be a run for each row update, so for each run you only need to update one item.

1 Like

You can do that, but what will be the use case for this, and how you have envisioned this? Since the items are not related(that is my assumption), do you need to update other Items?

Like, If one row is updated, when do you want to and why do you want to update other Inventory items? This can be done, by simply using the Search Rows Module, but I am not sure if that is required.

Since, the scenario is active and is triggered instantly whenever there is changes to any of the row, you can keep on updating other rows and it will be dealt with individually by the scenario in make.

1 Like

Thanks all for your input. Here’s the latest attempt… still not working, although I think I’m possibly on the right track(?)

First is the gsheet. The rows represent different Shopify products. Stock in column G can update against 1, 2 or all 3 rows.

Here’s the scenario…

Within the Google Sheets Search Rows module, I’ve configured as follows:

I’ve set up 3 filters to filter against column I (Inventory item ID) in the spreadsheet. The filters are for the 3 inventory item IDs as follows:

  • 22264514609241
  • 22276293230681
  • 22264514642009

Finally, we have our Shopify Update an Inventory Level module set up as follows:

Column I in the gsheet is set as the Inventory item ID.
We then have a simple expression that says if column G value (stock) is equal to “Add to basket” then set inventory to 100. Otherwise if column G value (stock) is equal to “Email me when back in stock” then set inventory to 0.

This is working, except it’s setting ALL inventory IDs to either 0 or 100. Using the gsheet screenshot example at the top of this post, if line 2 changes to “Email me when back in stock”, for inventory ID 22264514609241, the inventory for this ID is set to 0, but so is the inventory for all other IDs, even if they have a value of “Add to basket”.

I had envisioned the following…
Let’s say we have the following Shopify products in the current state

  • Line 2 inventory item ID 22264514609241 with column G value set to “Email me when back in stock”
  • Line 3 inventory item ID 22276293230681 with column G value set to “Add to basket”
  • Line 4 inventory item ID 22264514642009 with column G value set to “Email me when back in stock”

We then have several changes in the gsheet as follows:
Let’s say we have the following Shopify products in the current state

  • Line 2 inventory item ID 22264514609241 with column G value changes to “Add to basket”
  • Line 3 inventory item ID 22276293230681 with column G value changes to “Email me when back in stock”
  • Line 4 inventory item ID 22264514642009 with column G value changes to “Add to basket”

I would now expect the inventory in Shopify to change as follows:

  • Line 2 inventory item ID 22264514609241 available inventory = 100
  • Line 3 inventory item ID 22276293230681 available inventory = 0
  • Line 4 inventory item ID 22264514642009 available inventory = 100

What is actually happening is that inventory in Shopify changes as follows:

  • Line 2 inventory item ID 22264514609241 available inventory = 100
  • Line 3 inventory item ID 22276293230681 available inventory = 100
  • Line 4 inventory item ID 22264514642009 available inventory = 100

As I say, I think this is possibly due to the expression I’m using, but I’m not entirely sure. Any input would be greatly appreciated!

Instead of if case, just use the switch function,

{{switch(7.stock; “Add to Basket”; 100; “Email me when back in stock”; 0)}}

Screenshot from 2023-06-20 21-08-58

or, Modify your If case to,

{{if(7.stock = “Add to Basket”; 100; if(7.stock = “Email me when back in stock”; 0))}}

Not, Sure If I am missing anything, but give it a try and see how it works.