KBEC-00234 - Run a Step Various Times

Summary

You want to know how to run a step various times based on a count passed as a parameter to the procedure.

Solution

ElectricFlow currently does not support loops for steps. We can, however, place the step that you want to run various times into a procedure, then call the procedure various times.

Examples

  1. Create a new project "Sample Project".
  2. Create a procedure "Container of the step to be run various times".
  3. Create the step that you want to run various times in the procedure "Container of the step to be run various times".
  4. Create a procedure "Caller".
  5. Create a parameter "howmany" to procedure "Caller".
  6. Create a step in procedure "Caller", set Shell to ec-perl, and enter the following text in the Command(s) field:
    
    use ElectricCommander;
    $cmdr=new ElectricCommander->new();
     
    print "You want to run $[howmany] times";
    my $count = 0;
    until ($count >= $[howmany]) {
        $cmdr->runProcedure("Sample Project", {procedureName => "Container of the step to be run various times", pollInterval => "2", timeout => "30"});
        $count++;
    }
    

    Parameter "pollInterval => "2", timeout => "30"" is optional. The steps will be run in parallel when omitted and the steps will be run in serial when given. The value of pollInterval and timeout should be specified according to the time needed to run that step. Please refer to on line help of runProcedure for more details.

Have more questions? Submit a request

Comments

Powered by Zendesk