4 Replies Latest reply on Nov 15, 2017 2:20 PM by Sidharda Chava

# HP - Use variable in @ALLOCATE

Hi Folks!

I need to use variable as the parameters of @ALLOCATE in a Calculation manager rule. Unfortunately, it is not working (no validation). My version is 11.1.2.4.

Below, an example...

VAR PREMISSA1 = #MISSING;
VAR PREMISSA3 = #MISSING;
VAR TESTE_ANA_PREMISSA1;
VAR TESTE_ANA_PREMISSA3;

ARRAY PREMISSA2["PRODUCT"];

FIX "N/A - Rateios,"PJ999,"V0,"Actual","UG999","PREMISSA_ANA","NA_EMPRESA","M01","FY17")

"CC999"(

PREMISSA1 = @MEMBER("INPUT_ANA"->"PR999"->"PARCERIA NA"); /* it is working! */

IF (@ISMBR( "MD9999") AND @ISMBR("PR999") AND @ISLEV("Parceria",0))
IF ( "PREMISSA_ANA" == [[TESTE_ANA_SL.BBC20]] )

PREMISSA2 = @LEVMBRS("Total Prod",0);
PREMISSA3 = @LEVMBRS("Total Prod",0);
"RESULT_ANA" = @ALLOCATE (PREMISSA1, PREMISSA2 ,{TESTE_ANA_PREMISSA6} ,, share);  /* if I use PREMISSA2 or PREMISSA3 as second parameter, no validation. If I use ,{TESTE_ANA_PREMISSA6} as third parameter and replace PREMISSA2 to @LEVMBRS("Total Prod",0); it works! */

ENDIF
ENDIF
)

ENDFIX

I really apreciate any help!

best regards,

Ana Teresa

• ###### 1. Re: HP - Use variable in @ALLOCATE

Hi

It's normal, the second argument of @ALLOCATE is supposed to be a range. Variables and arrays are not ranges. Given the logic of your current script why can't you use @LEVMBRS("Total Prod",0) as the second argument?

Cheers

JM

• ###### 2. Re: HP - Use variable in @ALLOCATE

Dear Julien,

Thank you for the answer.

I would like to have a flexible allocate command to change to (for example):

"RESULT_ANA" = @ALLOCATE (PREMISSA1, @LEVMBRS("Total Prod",0); ,{TESTE_ANA_PREMISSA6} ,, share);

"RESULT_ANA" = @ALLOCATE (PREMISSA1, @REMOVE(@LEVMBRS("Total Prod",0),"PR999"); ,{TESTE_ANA_PREMISSA6} ,, share);

Regards

Ana Teresa

• ###### 3. Re: HP - Use variable in @ALLOCATE

Then I would suggest using Run Time Prompts instead of variables.

• ###### 4. Re: HP - Use variable in @ALLOCATE

2nd parameter is a Range member, 3rd parameter is a member. So hence 2nd and 3rd members are to be members. But in your case PREMISSA2 or PREMISSA3 are variables that have integer values. That is the reason validation fails.

In below statement

PREMISSA3 = @LEVMBRS("Total Prod",0);

if you are assuming that PREMISSA3 will have a text value "@LEVMBRS("Total Prod",0)" you are wrong. Instead it takes sum (based on aggregation) of level 0 members which will be numeric value. That is the reason validation is failing.

If you can explain your complete requirement then we can give a solution accordingly.