nsacyber/WALKOFF

Easy way to loop through a list

richardmhope opened this issue · 2 comments

Is there an easy way to loop through a list in a workflow? e.g. I have an action that retrieves a list of strings and I want to do an action on each of those strings individually. It looks like it might be possible using some combination of transforms and list selects but I can't quite wrap my head around it :-S

To my knowledge there's not currently way to do a "for each" type of loop in the playbook editor. If you could use a branch counter to increment the list selection, that would probably be the way to do it, but the selection is only a static value right now.

The workaround for now would be to modify the action to take a list of strings to operate on instead of just one.

We're currently working on a 1.0 release (with a soft target of the end of the month) that, among other things, overhauls the worker and executor using containers for concurrent/parallel execution of actions. Included in that is the ability to parallelize an action by splitting the workload on one of its list type arguments (though due to the asynchronous nature of it, this does not guarantee order).

If a dedicated loop construct would be useful to you, we could definitely add them to the roadmap. The only caveat is that the loop needs to be able to be finite and able to be unrolled at workflow start.

Ok, will update to app so the action accepts a list. Interestingly it is perfectly possible to create an infinite loop. I got to this while lookingfor a way to have a temp variable to hold the incremented value
infiniteloopworkflow