Skip to Content
avatar image
Former Member

Can I use nested IIF statement in Script Logic?

Hi Experts,

Is a nested IIF statement allowed in Script Logic?

The following IIF statement is allowed, which is not nested.

*SELECT(%ENTI%,ID,ENTITY,MATBUSI=1)
//IF THERE IS CG PRICE, THEN
*XDIM_MEMBERSET ENTITY=%ENTI%
*XDIM_MEMBERSET MATFLOW=HY
*XDIM_MEMBERSET KEYTYPE=PRICE
*XDIM_MAXMEMBERS ENTITY=5
[KEYTYPE].[#PRICE]=IIF(([KEYTYPE].[PRICE],[MATFLOW].[CG])<>"",([KEYTYPE].[PRICE],[MATFLOW].[CG]),([KEYTYPE].[PRICE],[MATFLOW].[QCKC]))
*COMMIT

When I make a nested IIF statement, the system validated it but when I run the script, it noted a syntax error.

*SELECT(%ENTI%,ID,ENTITY,MATBUSI=1)
//IF THERE IS CG PRICE, THEN
*XDIM_MEMBERSET ENTITY=%ENTI%
*XDIM_MEMBERSET MATFLOW=HY
*XDIM_MEMBERSET KEYTYPE=PRICE
*XDIM_MAXMEMBERS ENTITY=5
[KEYTYPE].[#PRICE]=IIF(([KEYTYPE].[PRICE],[MATFLOW].[CG])<>"",([KEYTYPE].[PRICE],[MATFLOW].[CG]),IIF(([KEYTYPE].[PRICE],[MATFLOW].[SC])<>"",([KEYTYPE].[PRICE],[MATFLOW].[SC]),([KEYTYPE].[PRICE],[MATFLOW].[QMKC]))) *COMMIT

Could anyone tell me how can I fullfill it?Thanks a lot.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 28, 2017 at 08:47 AM

    I do not recommend using MDX statements in script logic at all - very slow! Use when/ENDWHEN !

    And describe your calculation logic.

    Add comment
    10|10000 characters needed characters exceeded