Mitch McAlister : ok. that’s helpful… I’ll see if I can run with that. thanks again
Mitch McAlister : one more question… how would I go about incrementing the parameter values for each loop?
for the singleton POST, the parameter expression looks like this {{steps.getjobs.$[return_value.jobs[0].title](http://return_value.jobs[0].title)}}
but that is just for the first records in the response… how do I enable the pameter expression to increment that jobs[0]
value for each loop?
Dylan Sather (Pipedream) : do these resources help? https://launchschool.com/books/javascript/read/loops_iterating
Dylan Sather (Pipedream) : or are you asking about something different?
Mitch McAlister : I’m not really a js guy, so this is starting to go over my head. I was able to pull data from the step 2 response, and put the data into the parameters for step 3, but I think my path is specific to the 0
record. if I want to run the loop, should I just kill the parameter schema, and do the whole post in code?
Dylan Sather (Pipedream) : I see what you mean now. You’ll want to do the whole thing in code. So in this example:
for (const job of steps.getjobs.$[return_value.jobs](http://return_value.jobs)) {
console.log(job.id)
console.log(job.title)
// etc.
}
You essentially have access to each job
's data within the loop. So you can access each job’s properties by referencing job.id
, job.title
, etc. You’ll want to pass the appropriate job
property to each field in your POST
request in the data
block:
data: {
url: job.absolute_url,
location: job.location.name,
// etc.
}
Dylan Sather (Pipedream) : let me know if that makes sense
Mitch McAlister : ok. thanks