Loop variables missing from loop's linked block

I have a loop block with JS code to format the Body of each email I am sending out. However the email block that it flows to does not see the Loop block's output:

value is missing from the input.

I have another loop in the same workflow which works as expected:

1 Like

Hello @bradlymathews!

What it looks like is happening here is that your filter node (the second screenshot) is processing an array by default. It expects the array as the input and can parse the value keyword internally based on the node logic.

The first screenshot shows you attempting to use the array of data from FormatEmailBody without iterating. To send these e-mails, you need to use a separate loop node which takes FormatEmailBody as the Loop Input and then you will be able to use the value keyword.

Created a Loop block with an Email runner works. Thanks!

But it seems like an inconsistency to me. If the GetTodaysAbilities Loop block outputs an array in value to a Filter Block, why doesn't the FormatEmailBody Loop block behave the same way to a Resource Query?

Maybe I wasn't not seeing the flow correctly. A Resource Block only runs once. If it follows a Loop block, it does not get executed for each loop as seems logical to me. You need a Loop block with the correct Resource as it's runner.

Am I interpreting that correctly?

That is correct in most cases. Think of it this way:

If you were to use a Code Block and connect in your loop block you could access the array like this:

var array = FormatEmailBody.data

But how would you process the array? You'd need to iterate over it by using a for-loop or a map function or other looping arrangement.

for(let i =0; i < array.length; i++) {...} or array.map(item-> {...})

Setting up a node which is made to process arrays takes care of this code step for you, supplying the individual entries as the value keyword. GetTodaysAbilities is an array, which lets you use it in the Loop block. If you were to connect a block which did not output an array, both the Loop block and the filter block will show you that your input is not iterable.

I hope this makes sense.

1 Like

:wave: @bradlymathews Just checking in! Were you able to move forward with a solution? Thanks for chiming in @pyrrho