cancel
Showing results for 
Search instead for 
Did you mean: 

conditional executing commands in logic script

former_member617674
Participant
0 Kudos

Hi All,

One of our scripts calculates different values based on base revenues - discounts, excise, know how fee, unpaid receivables etc.

*XDIM_MEMBERSET TIME = 001.2016

*XDIM_MEMBERSET CATEGORY = BUDGET

*XDIM_MEMBERSET ENTITY = BAS(ENTITY_ALL)

*XDIM_MEMBERSET PRODUCT = BAS(PRODUCT_ALL)

*XDIM_MEMBERSET ACCOUNT = REVENUE_BASE

*WHEN ACCOUNT

*IS REVNEUE_BASE

*REC(FACTOR=([ACCOUNT].[PERC_DISCOUNT_001],[ENTITY].[NO_ENTITY]),ACCOUNT=DISCOUNT_001_VALUE)

*REC(FACTOR=([ACCOUNT].[PERC_DISCOUNT_002],[ENTITY].[NO_ENTITY]),ACCOUNT=DISCOUNT_002_VALUE)

*REC(FACTOR=([ACCOUNT].[PERC_DISCOUNT_900].[ENTITY].[NO_ENTITY]),ACCOUNT=DISCOUNT_900_VALUE)

*REC(FACTOR=([ACCOUNT].[EXCISE_RATE],[PRODUCT].[NO_PRODUCT],[ENTITY].[NO_ENTITY]),ACCOUNT=EXCISE_VALUE)

*REC(FACTOR=([ACCOUNT].[KNOW_HOW_FEE],[PRODUCT].[NO_PRODUCT]),ACCOUNT=KNOW_HOW_VALUE

*ENDWHEN

We would like to calculate values based on values passed by user in executing package box.

Let say, user chose EXCISE_RATE and KNOW_HOW_FEE - we don't want to calculate discounts at all (so existing values will be left in model)

Is it possible to do this using logic script? one of our ideas was change "sides" in script and multiply "factors" per REVENUE_BASE - but it would extend our code a lot... and what's more - it would be allocation, because most of the factors are "one value", and REVENUE_BASE value is per product, entity etc...

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Michal,

If i understand the issue, You can handle it using following members name.

Rate1: PERC_DISCOUNT_001

Value: DISCOUNT_001

Rate2: PERC_DISCOUNT_002

Value: DISCOUNT_002

Rate3: PERC_KNOW_HOW_FEE

Value: KNOW_HOW_FEE

And, when you choose account values on data manager; for example, DISCOUNT_001,KNOW_HOW_FEE.

*FOR %P_ACCOUNT% = %ACCOUNT_SET%

*WHEN ACCOUNT

*IS REVNEUE_BASE

*REC(FACTOR=([ACCOUNT].[PERC_%P_ACCOUNT%],[ENTITY].[NO_ENTITY]),ACCOUNT=%P_ACCOUNT%)

*ENDWHEN

*NEXT

Regards.

Burak

former_member186338
Active Contributor
0 Kudos

Hi Burak,

The idea is correct, but the implementation can be better:

1. In the ACCOUNT dimension create property TARGET and fill it:

ACCOUNT                         TARGET Property

PERC_DISCOUNT_001    DISCOUNT_001_VALUE

PERC_DISCOUNT_002    DISCOUNT_002_VALUE

PERC_DISCOUNT_900    DISCOUNT_900_VALUE

EXCISE_RATE                       EXCISE_VALUE

KNOW_HOW_FEE                 KNOW_HOW_VALUE


2. User will be able to select single or multiple accounts with PROMPT(SELECTINPUT... in DM package advanced script.


3. The code will be:


*XDIM_MEMBERSET TIME = 001.2016

*XDIM_MEMBERSET CATEGORY = BUDGET

*XDIM_MEMBERSET ENTITY = BAS(ENTITY_ALL)

*XDIM_MEMBERSET PRODUCT = BAS(PRODUCT_ALL)

*FOR %ACC% = %ACCOUNT_SET%

*XDIM_MEMBERSET ACCOUNT=%ACC% //ex.: PERC_DISCOUNT_001

*WHEN ACCOUNT

*IS *

*REC(EXPRESSION=[ACCOUNT].[REVENUE_BASE]*[ENTITY].[NO_ENTITY],ACCOUNT=ACCOUNT.TARGET)

*ENDWHEN

*NEXT

Vadim

P.S. Explanation of the formula:

([ACCOUNT].[REVENUE_BASE],[ENTITY].[BAS(ENTITY_ALL)])*([ACCOUNT].[PERC_DISCOUNT_001],[ENTITY].[NO_ENTITY])

Target - DISCOUNT_001_VALUE


Ups, the code will not work!

former_member186338
Active Contributor
0 Kudos

Next one - hope it will be working :

*SELECT(%TS%,[TARGET],ACCOUNT,"[ID]=%ACCOUNT_SET%") // get list of target accounts

*XDIM_MEMBERSET TIME = 001.2016

*XDIM_MEMBERSET CATEGORY = BUDGET

*XDIM_MEMBERSET ENTITY = BAS(ENTITY_ALL)

*XDIM_MEMBERSET PRODUCT = BAS(PRODUCT_ALL)

*XDIM_MEMBERSET ACCOUNT = REVENUE_BASE

*FOR %ACC%=%ACCOUNT_SET% AND %T%=%TS%

*WHEN ACCOUNT

*IS *

*REC(FACTOR=([ACCOUNT].[%ACC%],[ENTITY].[NO_ENTITY]),ACCOUNT=%T%)

*ENDWHEN

*NEXT

Vadim