cancel
Showing results for 
Search instead for 
Did you mean: 

FOR/NEXT Loop

Former Member
0 Kudos

Hi,

I am trying to use the FOR/NEXT loop as follows:

*FOR %A% =MAT10000, MAT10001, MAT10002

[MATL_ACC].[MAT10278]=[MATL_ACC].[MAT10278]+LOOKUP(EP5C37FST)([MATL_ACC].[%A%])

*COMMIT

*NEXT

where MATL_ACC is an account and MAT10000, MAT10001, MAT10002 and MAT10278, its members.

Somehow, the cursor does not enter the loop even when the conditions are met. What could be the reason for this?

TIA!

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

We have the following dimensions in our application:

- TIME

- MATL_ACC

- ENTITY

- CATEGORY

The code we are using is :

*LOOKUP RMRECIPE

*DIM ENTITY="BOPP"
*DIM CAT="BUDGET"
*DIM MEASURES="PERIODIC"

*DIM EP5C37FST:RAW_MATERIALS="EP5C37FST"
*DIM PKS407:RAW_MATERIALS="PKS407"

*ENDLOOKUP

XDIM_MEMBERSET = 2009.DEC

FOR %A% =MAT10000, MAT10001, MAT10002
*MATL_ACC.MAT10278=MATL_ACC.MAT10278+LOOKUP(EP5C37FST)*(MATL_ACC.%A%)
*COMMIT
*NEXT 

where MATL_ACC is an account and MAT10000, MAT10001, MAT10002 and MAT10278, its members and the requirement is to add to the existing value of raw materials for all the members in MATL_ACC. MATL_ACC contains the list of both raw materials and finished goods.

Could you please help with this?

Thanks

Former Member
0 Kudos

Hi,

We are not using any WHEN condition. This is a piece of code that we are using just to test whether FOR/NEXT loop can run as we require. Could you suggest if there is anything that we need to add to the code?

Thanks.

Former Member
0 Kudos

Hi,

Is this the entire script? You need to have the XDIM_MEMBERSET to filter on your dimension.

Hope this helps.

Former Member
0 Kudos

Hi,

Do you have any when condition? Are you passing any parameters to the script through DM? Can you please share the entire code for better understanding of the issue?