Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 63 Insurance
- 536.4K On-Premises Infrastructure
- 138.3K Analytics Software
- 38.6K Application Development Software
- 5.8K Cloud Platform
- 109.5K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.3K Integration
- 41.6K Security Software
Loopy

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....
Best 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
Parameter Description 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.
Answers
-
Have you tried to add an ampersand in front of your variable name?
VAR TimesX=5;
Loop(&TimesX, quit)
EndLoop
-
Have a look at VAR functionality:
-
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
Parameter Description 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.
-
Loop doesnot work on local variables instead you can try runtime prompts.