Skip to Content
0

Can I use nested IIF statement in Script Logic?

Dec 28, 2017 at 08:07 AM

30

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Vadim Kalinin Dec 28, 2017 at 08:47 AM
0

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

And describe your calculation logic.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks a lot. I use WHEN/ENDWHEN and it works well.

0