Please enable JavaScript to view this site.

Codolex

The loop activity offers the ability to iterate over lists. There are three different loop types: While, For, and For..In.

 

clip0050

 

A Loop variable name has to be defined for use inside the loop, the item from the list will be parsed in this variable for use.

Variables defined outside the loop are usable inside the loop. However, variables defined inside a loop are not usable outside the loop.

 

Within the loop itself, you have to define the (sub)flows.

clip0044

Loop in flow

 

begin

 for var i := 0 to Max do

begin

  var IsLoaded: Boolean;

   IsLoaded := True;

  var CustomerViewList: ICodolexList<Project.DataSource.Codolex.ICustomerView>;

  var SQL :=

    'SELECT CustomerView.* '+ sLineBreak +

    'FROM CustomerView AS CustomerView ';

   

  var Params: IDatabaseParams := TDatabaseParams.Create;

   

   CustomerViewList := Project.DataSource.Codolex.CustomerViewDataBroker.GetList(SQL, Params);

end;

end;

Resulting code

 

Break and Continue

Inside a loop, the break and continue activities can be used.

A break will stop the loop and continue the flow after the loop.

A continue will stop this iteration, and go to the next iteration if there is one available

 

BreakAndContinue

Loop in flow

 

..

 for var String in StringList do

begin

  if (String = value = null) then

  begin

     Break;

  end

  else

  begin

     Continue;

  end;

end;

..

Resulting code

© by GDK Software