cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Script Logic - REC Statement Variable usage

Former Member
0 Kudos
133

hi friends

Pl find enclosed the following code:

*WHEN TIME

*IS TMVL(-1,2011.04)

*WHEN ACCOUNT

*IS "EXP01"

*REC(EXPRESSION = [TIME].[2011.04]-%VALUE%,TIME = 2011.04,ACCOUNT = EXP01A)

*ENDWHEN

*ENDWHEN

The above code is working fine and result is extracted but i have hardcoded , ACCOUNT=EXP01A;

My Query is follows:

I have used

*WHEN ACCOUNT

*IS "EXP01"

In REC i want to use concatenation of "A" To account like EXP01&"A"

i know account & i want to concatenate "A" and use in REC statement like assign to variable

var1="EXP01" & "A" and use var1 in REC

*REC(EXPRESSION = [TIME].[2011.04]-%VALUE%,TIME = 2011.04,ACCOUNT = var1)

i am not sure the syntax (Whether we need to put in strings)

Also if EXP02 then var1="EXP02"&"A" and so on

In fact i want to make this for all members in Account Dimenstion as generalised.

Pl. verify and suggest best possibility

Thanx & Rgds

Srinath

Accepted Solutions (0)

Answers (1)

Answers (1)

krishna_priya1
Contributor
0 Kudos

For concatenation , string that is to be appended,should be placed next to the member either it is static or dynamic .For example ,if %VAR1% has EXP01 , to append A ,syntax for concatenation is %VAR1%A . Sample code is below.


*XDIM_MEMBERSET ACCOUNT AS %ACC% = EXP01
*WHEN ACCOUNT
*IS %ACC%
*REC(EXPRESSION = %VALUE%*2,TIME = 2011.04,ACCOUNT = %ACC%A)
*ENDWHEN

If above code needs to be generalised, *FOR *NEXT can be used .


*XDIM_MEMBERSET ACCOUNT AS %ACC_LIST% = EXP01,EXP02,EXP03,EXP04
*FOR %ACC_MBR% = %ACC_LIST%
*WHEN ACCOUNT
*IS %ACC_MBR%
*REC(EXPRESSION = %VALUE%*2,TIME = 2011.04,ACCOUNT = %ACC_MBR%A)
*ENDWHEN
*NEXT

Former Member
0 Kudos

Hi Krishna

*XDIM_MEMBERSET ACCOUNT AS %ACC% = EXP01

*WHEN ACCOUNT

*IS %ACC%

REC(EXPRESSION = %VALUE%2,TIME = 2011.04,ACCOUNT = %ACC%A)

*ENDWHEN

Is it required to add EXP01A as below?

XDIM_MEMBERSET ACCOUNT AS %ACC% = EXP01, EXP01A

Also In Generalized code you have mentioned:

Instead of Hard Coding EXP01, EXP02 can i have hierarchy of all EXP , so that if any new account added in dimension, there will be no change in script logic. Pl. can you share how to use the same.

If above code needs to be generalised, *FOR *NEXT can be used .

*XDIM_MEMBERSET ACCOUNT AS %ACC_LIST% = EXP01,EXP02,EXP03,EXP04

*FOR %ACC_MBR% = %ACC_LIST%

*WHEN ACCOUNT

*IS %ACC_MBR%

REC(EXPRESSION = %VALUE%2,TIME = 2011.04,ACCOUNT = %ACC_MBR%A)

*ENDWHEN

*NEXT

Rgds

Srinath

Former Member
0 Kudos

Hi,

No, you dont need to have EXP01A in the XDIM statement. You dont need to mention the destination members in the XDIM statement.

In the FOR statement, you need to mention all the members on which the code should run.

Hope this helps.

krishna_priya1
Contributor
0 Kudos

In addition to nilanjan specified , Yes you can have hierarchy of all EXP , with BAS function.Just change scope of account as

*XDIM_MEMBERSET ACCOUNT AS %ACC% = BAS(ALLEXP) , assuming ALLEXP is parent account of all expense account.

Hope this helps.