6 Replies Latest reply: Jun 19, 2010 10:14 PM by 776485

how does it work...LOOP,..ENDLOOP logic

I just tried the script below to understand the loop logic.

FIX ("Person","Jan")

var c=0;

LOOP(2)
"wage"
(
c=c+1;
c;
)
ENDLOOP

ENDFIX

I expected that the result of the calculation would be wage = 2 but instead I found wage = 10.
I tried this with LOOP(2) too and the result was wage = 19.

it is like when loop = 1 c= 1
when loop = 2 c= 10
when loop = 3 c= 19

I am completely lost in LOOP logic. How does this logic work.
• 1. Re: how does it work...LOOP,..ENDLOOP logic
Just a hunch here but I'm guessing that you have more than 3 dimensions in the outline. You need to specify a member for all of the dimensions in the fix. For example, if there is a 4th dimension named scenario, your logic will automatically process all of the scenario members meaning that "c" will get incremented more times then you are expecting.

You need a better understanding of the essbase order of execution and how it relates to the FIX. The admin guide doc will help you with this. Once you understand how essbase cycles through the dimensions you will see that "loop" is not commonly used.

Dave
• 2. Re: how does it work...LOOP,..ENDLOOP logic
I agree with Dave on this one. You are most likely going through another dimension. TO see the actual activity, turn on msg detail, clear out the application log and then run the calc. It will show you each block it going through on the calculation
• 3. Re: how does it work...LOOP,..ENDLOOP logic
I couldn't find the application log . would you tell me the address for application log in the server.

thanks,
• 4. Re: how does it work...LOOP,..ENDLOOP logic
I now found the application log :)

thanks again for the info.
• 5. Re: how does it work...LOOP,..ENDLOOP logic

I have these dimesions : company , costcenter , person , period.

company has comp1 , comp2 members
costcenter has cc1 , cc2 members
person has p1 , p2 members
period as usual.

I have only two data blocks which are ; comp1->cc1->p1->begbalance and comp1->cc1->p2->begbalance
I dont have any data for comp2 or cc2.

And my whole script as below.When I check the app.log I see the script created data for comp2 and cc2 aswell.
But in the script I didnt even used "SET CREATENONMISSINGBLK ON".is this typical for essbase.
I even tried "SET CREATENONMISSINGBLK OFF" nothing changed.
So how can I manage my script to work for only existing data.

FIX(@RELATIVE ("company",0),@RELATIVE ("costcenter",0),@RELATIVE ("person",0))
FIX ("jan")

SET MSG DETAIL;

LOOP(1)
"wage"
(
c=c+1;
c;
)
ENDLOOP

ENDFIX
ENDFIX

ENDFIX
ENDFIX
• 6. Re: how does it work...LOOP,..ENDLOOP logic
I guess there is data for Comp2 & CC2 in the combination of some dense member say any period or account.

The calculation will not create block, but if the block is already there, the calculation will be done and the result is stored in corresponding cell (dense calc).

- Krish