Why is my original source module not a selectable option

So I’m new to Make, but not to developing, so forgive me if i’m trying to code when i should be using modules differently.

Here is my scenario:

Starts with a watch google sheet for new rows after the user fills out a form
the Sheet has these columns

  • Timestamp
  • Order #
  • SKU 1
  • SKU 1 Quantity
  • SKU 2
  • SKU 2 Quantity
  • SKU 3
  • SKU 3 Quantity
  • First Name
  • Last Name

I need to turn SKU1-3 into Item Orders which i have successfully been able to to with this workflow however since modifying and adding modules in the middle I now no longer can access the Google Sheets module to use the other data in the Ship Station module.

The Text Aggregator is used to make a JSON array of data based on the three sku column combinations

I than parse that as JSON and run it through the Array Aggregator to map over the array of sku data to make Ship Station Order Items

Sometimes when this happens I just hit “Run Once” so it can redetect the outputs from the bundles again.

2 Likes

I’ve been struggling to understand this behavior as well and came to the conclusion that since the module, in this case the trigger, outputs multiple bundles (acting like an Iterator), those are only available to the modules that follow it, and those modules will all run once for each bundle.

If you follow with an aggregator, like you are, then the following modules should have access to the result the aggregator. The aggregator sort of closes access to the Iterator.

Since you have an array aggregator, you should be able to use map() function on the array in its output bundle to pull data from it.

Really curious on the other thoughts on this as well.

1 Like

Thanks for the suggestion, I tried this but this doesn’t seem to help. The Ship Station module only is still only giving the same 2 modules. as Sources. I assume it has something to do with the Grey shapes but don’t know enough about make to understand it.

I assume it has something to do with the Grey shapes around the two areas because the last module in each section are the only ones available. I don’t know enough about make to understand it though. I does seem that the Text Aggregator seems to be an ending module like it’s meant to compile the data from the previous modules into the final modified data. I think i’ll see if i can use another type of modules to convert the individual cells into an array that i can loop over.

I was able to resolve the issue by not using a Text Aggregator and instead just Compose a String as text and insert that in place and it works!! Thanks @Donald_Mitchell and @samliew for the quick responses.

Final working solution:


Where i was able to take the same “code” in the old Text Aggregator and put it in the Compose a string module.

2 Likes

Heya @Freytag :wave:

I just wanted to quickly jump in and say awesome work figuring this out on your own! Also, thanks a lot for keeping the community in mind and coming back here to share what you learned with us. We 100% appreciate it :pray:

Keep up the great work :sunny:

2 Likes

Hello @Freytag, if there’s no sensitive information, are you able to share how you built your #48 Compose a string and what the output looks like?
I’m dealing with something else and curious what you’ve done here. Thanks!

1 Like

I used the exact same text shown in my old Text Aggregator #36

Here’s the full copy paste not sure how well it’ll copy over.

[if(1.`2` != emptystring; "{""sku"":""" + 1.`2` + """,""quantity"": """ + ifempty(1.`3`; 1) + """}"; )if(1.`4` != emptystring; ",{""sku"":""" + 1.`4` + """,""quantity"": """ + ifempty(1.`5`; 1) + """}"; )if(1.`6` != emptystring; ",{""sku"":""" + 1.`6` + """,""quantity"": """ + ifempty(1.`7`; 1) + """}"; )}}]

To explain what i’m doing. I am manually creating a JSON array of objects.
so starting with [ and ending with ]. I then use the if( 1 = 1 ; a ; b ) operator to check if sku1 is NOT != an emptystring. If it has a value I then construct a JSON object {"sku":"sku1","quantity":"sku1Quantity"} else I close the if early;), and don’t pass in a value. For the skuQuantity In quantity I use the"ifempty( a ; b )" if skuQuantity has a value or return 1, the thing i didn’t realize here initially was I needed to wrap the ifempty operator in the double quotes instead of the values in it. With JSON pretty much everything (keys & values) need to be wrapped in double quotes ". I also learned that you can’t have any returns, keyboard return, or it adds in \n and that is invalid in the json. I was doign this initially to make it easier to read this code. Let me know if i can help further @Donald_Mitchell.

1 Like

Thank you for sharing. This might actually be what I was wanting to do, but wasn’t sure it would work.

Also, don’t forget about ifempty() function. It’s a shorter version of using if() to check if something is empty or not, and if so, uses a different value instead.

Ifempty(a;b)

The syntax is a little weird but this will use a if it’s not empty, otherwise returns b.

Cheers!

2 Likes