Share on ... Google+ Twitter LinkedIn Facebook Pinterest Loop Task is a powerful util to trigger actions within a defined loop. The basically configuration is like a default For – Loop of any general development languages. This task have two outputs: The top one “Loop Path” should be only used if you enable the Loop option “Loop path output” within the configuration. Per default use the bottom one labeled with “Output” for other tasks within the same Workflow. Because a loop theoretically could run without any ending (endless loop), please double check the Finish configuration before you execute the workflow. If you run into an endless loop, you could restart your webserver or wait a long time, until the upper limit is reached. In any case: There is a upper limit of 2500 iterations, which stops the task. You cannot use more then 2500 iterations, also if you want to. Configuration The most important fact you should recognize is, every configuration in this task is based on the “green template fields”. These are not the default template fields, because they are parsed and executed like a PHP Script. This means you should only input correct PHP syntax. You MUST include a return statement within every field. The general structure is like: Initialize a variable Check if until configuration returns “true”. If false, leave loop and continue with “Output” path Execute the configured Loop Increment the Loop Variable Go to step 2 Let me explain this, on an example: This loop is executed exactly 20 times. Look at the initialization (1). The $loop variable, which is handled internally, is one time set to 1 at the beginning of the loop. Then directly the Finish condition (2) will be checked to check, if the loop must be executed at all. In this example I check if the $loop variable is lower or equal to 20, which is true, during the first execution. Let us skip (3) and come back later. Now the loop is executed. You could configure to execute the tasks you connect to the “Loop Path” Output. (4) One other option is to execute an expression during each iteration. (4) The expression you want to execute should be configured in (6). You could use all function you have created and have access to $loop, $env and all fields of the current record. At least you could execute a workflow during each iteration, (7) which is disabled in this example. If you enable the checkbox, you will get a select box to configure the workflow you want to execute. If the iteration is done, the condition (3) (We skipped earlier) is executed and must return the new $loop value. Theoretically you could also use this expression field to run an expression in every iteration. Because you follow a clean and useful configuration, you should not do this. Now you could use this block, like this: This path will be executed one time during every iteration. There must not be any connection back to the loop at the end This path will be executed at the end of the loop Discussion Real name: E-Mail: Address: Enter your comment. Wiki syntax is allowed: Please fill all the letters into the box to prove you're human. _ __ ______ ____ ____ _ __ | | /| / //_ __/ / _/ / __ \ | | / / | |/ |/ / / / _/ / / /_/ / | |/ / |__/|__/ /_/ /___/ \____/ |___/ Please keep this field empty: Subscribe to comments