Skip to Content
0
Former Member
Nov 25, 2009 at 11:06 PM

Conditions in calc script

33 Views

Hi all,

I need to clarify this question:

I have an application with 5 dimensions - Account, Entity, Category, Time and Version.

First, let's imagine that I have five accounts - A, B, C, D and E. I want to calculate C as sum of A and B and then E as substitution C - D. My script looks like this:

// I want to run the script only for entity 1X
*XDIM_MEMBERSET ENTITY=1X
// Category, Version and Time shall be set dynamically according to situation
*XDIM_MEMBERSET CATEGORY=%SET%
*XDIM_MEMBERSET VERSION=%SET%
*XDIM_MEMBERSET TIME=%SET%

*WHEN ACCOUNT
*IS A,B
  *REC(EXPRESSION=(GET(ACCOUNT="A")+GET(ACCOUNT="B")),ACCOUNT=C,NOADD)
*ENDWHEN

*GO

*WHEN ACCOUNT
*IS C,D
  *REC(EXPRESSION=(GET(ACCOUNT="C")-GET(ACCOUNT="D")),ACCOUNT=E,NOADD)
*ENDWHEN

*COMMIT

I'm working with BPC several months but I think I still don't understand how exactly BPC evaluates *WHEN clauses.

I think that when I change account A or B, then C is calculated correctly right after sending data, because first *WHEN clause will be evaluated. But what about the second *WHEN? I'm not sure if the second *WHEN will work because I didn't change C or D account. Or does BPC evaluates account C as changed and therefore the second *WHEN will work, too?

Thank you for answers!

Regards,

Vladino