cancel
Showing results for 
Search instead for 
Did you mean: 

Using functions in MDX logic script

Former Member
0 Kudos

How can i use  MDX functions like ABS, SIGN etc. in logic scripts?

Actually, i would like to save always positive values for example for revenues.

The script could be like that:

*WHEN ACCOUNT.ACCTYPE

*IS EXP

    *REC(EXPRESSION = ABS(%VALUE%))

*ENDWHEN

*COMMIT

But this gives a validation error "RefferenceError: ABS is not defined".

Maybe there is some other way to save the absolute value or to change sign in case the value is negative?

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Natalija,

You can't use ABS, SIGN...

If you use BPC NW 7.5 or BPC NW 10 with JAVASCRIPT calculation engine you can use some Java Script functions. Look here: https://blogs.sap.com/2012/10/08/inline-rounding-in-rec-expression/

For BPC NW 10 with ABAP calculation engine you have no options...

B.R. Vadim

former_member186338
Active Contributor
0 Kudos

And some additional clarification:

WHEN/IS/REC/ENDWHEN - is NOT MDX logic, it's SQL logic!

Vadim

Former Member
0 Kudos

Hi, Vadim

Thank you for clarification. Let's say BPC Script logic.

Maybe there is any option to make condition based on value, not on dimension member? For example we could just use -1 factor case the value is less than 0... I know something like that exists in Microsoft version, bet unfortunately we use BPC 10NW ABAP

Natalija

former_member186338
Active Contributor
0 Kudos

Hi Natalija,

The only conditional operator supported is ternary operator:

EXPRESSION or FACTOR=LogicalTest ? ExpressionIfTrue : ExpressionIfFalse

Like:

*REC(EXPRESSION=%VALUE%>0 ? %VALUE%*2 : 0)

If current value greater then zero then write current value multiplied by 2, else - write zero.

Fob BPC NW 10 with ABAP calculation engine nested ternary operator is not supported, with JAVASCRIPT calculation engine - nested is supported.

B.R. Vadim

Former Member
0 Kudos

Thank you!!!! That is exactly what i needed.

Just for additional clarification - sorry for stupid questoin, what is the difference between MDX and SQL scripts in context on BPC script logic?

Natalija

former_member186338
Active Contributor
0 Kudos

SQL syntax:

*WHEN ...

*IS ...

*REC(...)

*ENDWHEN

MDX syntax:

[SOMEDIM].[#SOMEMEMBER]=[SOMEDIM].[SOMEMEMBER1] + [SOMEDIM].[SOMEMEMBER2]...

Look on "#"

B.R. Vadim

Answers (0)