Forum Stats

  • 3,827,508 Users
  • 2,260,787 Discussions
  • 7,897,281 Comments

Discussions

Loopy

Robert Angel
Robert Angel Member Posts: 4,535 Bronze Crown
edited Jan 30, 2018 1:57PM in Planning and Budgeting

Hi,

I am trying to get a loop to work with variables in a Business Rule in PBCS and whilst it works with explicit values it does not seem to work with variables.

i.e.

Loop(5, quit)

EndLoop

Review log - it loops 5 times

Use a variable;

VAR TimesX=5;

Loop(TimesX, quit)

EndLoop

It does not loop at all.

I have also tried setting quit to 1 mid loop based on the incremented value of TimesX and that has the effect that the loop always exits as soon as it reaches the If logic.

Any ideas - the Essbase is a little sketchy on loop aside from a worked example where most of the syntax does not compile for me....

Tagged:

Best Answer

  • AlexLiu
    AlexLiu Member Posts: 124
    edited Sep 6, 2017 3:07PM Answer ✓

    I haven't used LOOP in a while, but I thought the rule is that it has to be an "integer" and can't be a variable.

    Syntax

    LOOP (integer, [break])COMMANDS ; ENDLOOP
    ParameterDescription

    integer

    The integer constant that indicates the number of times to execute the commands contained in the loop block.

    break

    Optional parameter used to break the iterative process of a loop. break
    must be the name of a temporary variable (VAR). Setting the value of
    the variable to 1 during the execution of the loop causes the loop to
    break at the beginning of its next iteration.

    COMMANDS

    Those commands that you want to be executed for the duration of the LOOP.

    Robert Angel

Answers

This discussion has been closed.