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.