iterate - ObjectVision/GeoDMS GitHub Wiki

MetaScript functions iterate

syntax

  • iterate(iteration_names, template, init_expr_item)

definition

iterate instantiates template once per entry of the string attribute iteration_names and chains the iterations: the first subitem of each instantiation (by convention currValue) receives as expression the previous iteration's nextValue (the first iteration receives the expression held by the string parameter init_expr_item). The result container also exposes lastValue: the nextValue of the final iteration.

example

unit<uint32> iters: nrofrows = 3 { attribute<string> name := 'it' + string(id(.)); }
parameter<string> init := 'uint32(0)';
Template step
{
    parameter<uint32> currValue;
    parameter<uint32> nextValue := currValue + uint32(1);
}
container res := iterate(iters/name, step, init);

res/lastValue results in 3.

see also

⚠️ **GitHub.com Fallback** ⚠️