This topic was automatically generated from Slack. You can find the original thread here.
KM_PD : Hi , about to give up on a simple nodejs script workflow. PLeaes help. i get undefined when passing values between steps. My workflow is getting data from Slack and writing to Airtable
KM_PD : Yes, console.log prints the required output.
I also added another nodejs step and printed the returned value, this.variable value in the next nodejs step. Still undefined
Dylan Sather (Pipedream) : Hi , when you return inside of a function, you’re returning to the caller (myArr.forEach), but that doesn’t return the data from the step. You’ll need to return the data at the top-level of your step. I’d recommend doing something like this:
const data = []
for (const value of myArr) {
if (value.indexOf("+") >= 0) {
data.push(value)
}
}
return data
KM_PD : Thanks! that makes sense. what is the best way to split a string, and for each word, write a record to a table then? Basically, breaking a single event into multiple events.