cancel
Showing results for 
Search instead for 
Did you mean: 

How to invoke child pipeline for 'N' times where 'N' is known only at run time in the parent pipeline?

ddangler
New Contributor III

Hello Forum,

I have a input document like this:

[
	{
		"count" : 10
	}

]

and I need to invoke child pipeline using Pipeline Execute snap 10 times. If count is 5, I need to execute child pipeline 5 times.

How can I achieve this? Thanks in Advance!

6 REPLIES 6

tstack
Former Employee

Leveraging the REST Snap’s pagination functionality is definitely the way to go for your use case, but I wanted to make sure your original question was answered as well. The Pipeline Execute snap will kick off a child pipeline for every document it receives (if reuse is turned off). So, to invoke something N times, you’ll need to generate N documents. Generating documents can be achieved with the Sequence snap, if the number is coming from a pipeline parameter. If the number is coming from a document, you can use the ‘sl.range()’ method to create an array that is then split with a JSONSplitter to create the documents for the PipeExec snap.

ddangler
New Contributor III

@tstack

Thanks so much! I love this community.