Skip to Content
0
Dec 28, 2017 at 08:07 AM

Can I use nested IIF statement in Script Logic?

103 Views

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.