cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BPC Script Logic Tripling Values

Former Member
0 Likes
2,389

We're using BPC 10.1 SP2 for NW and seeing odd behavior with BPC Script.  I've taken my actual more complicated script and stripped it down to a very simple form to confirm that the values are still tripled.  Note that the value is tripled on the first run.  Subsequent runs do NOT increase the value.

I have found a work-around by using a FOR loop, but this changed the run time from my script from 55 seconds to 18 minutes.  My code will eventually reside within a package and in Default logic, so 18 minutes is unacceptable.  I have hard-coded a few of the members for test purposes.  Any suggestions as to what might be happening?

Test Results:

1.  Multiple embedded WHEN statements did not change the behavior

2.  Omitting the MEASURES scoping did not change the behavior

3.  Limiting scope to a single ENTITY produced correct results but this is not a viable option

Code that triples:

*SELECT(%PROFIT_CENTERS%, "[ID]", "ENTITY", "[INTCO]<>''")

*XDIM_MEMBERSET ACCOUNT  = 701003

*XDIM_MEMBERSET AUDIT_ID = ALLOCATION_ENTRY

*XDIM_MEMBERSET CURRENCY = LC

*XDIM_MEMBERSET ENTITY   = %PROFIT_CENTERS%

*XDIM_MEMBERSET FLOW     = F_CLO

*XDIM_MEMBERSET INTERCO  = I_1000

*XDIM_MEMBERSET SCOPE    = S_NONE

*XDIM_MEMBERSET TIME     = 2012.03

*XDIM_MEMBERSET VERSION  = PLAN

*XDIM_MEMBERSET MEASURES = YTD

*WHEN CURRENCY

*IS LC

   *REC(EXPRESSION=(%VALUE%),VERSION="ACTUAL",AUDIT_ID="ALLOC_CALC_MGMT")

*ENDWHEN

Code that works but takes too long:

*SELECT(%PROFIT_CENTERS%, "[ID]", "ENTITY", "[INTCO]<>''")

*XDIM_MEMBERSET ACCOUNT  = 701003

*XDIM_MEMBERSET AUDIT_ID = ALLOCATION_ENTRY

*XDIM_MEMBERSET CURRENCY = LC

*XDIM_MEMBERSET ENTITY   = %PROFIT_CENTERS%

*XDIM_MEMBERSET FLOW     = F_CLO

*XDIM_MEMBERSET INTERCO  = I_1000

*XDIM_MEMBERSET SCOPE    = S_NONE

*XDIM_MEMBERSET TIME     = 2013.03

*XDIM_MEMBERSET VERSION  = PLAN

*XDIM_MEMBERSET MEASURES = YTD

*FOR %CENTER% = %PROFIT_CENTERS%

*WHEN ENTITY

*IS %CENTER%

   *REC(EXPRESSION=(%VALUE%),VERSION="ACTUAL",AUDIT_ID="ALLOC_CALC_MGMT")

*ENDWHEN

*NEXT

View Entire Topic
former_member5472
Active Contributor
0 Likes

Hi,

Is your original code tripling the values for all entity values selected in "Select" statement or just the one entity ?

It looks like you have used the "When" condition in a wrong manner.  If you want to generate separate records for each entity with version as Actual and Audit id as ALLOC_CALC_MGMT then use when condition for entity dimension or use a *for loop

Prat

Former Member
0 Likes

Let me try a different entity member and then I'll respond.  I've been testing with the same entity, so I'm not sure.

A FOR loop solves the problem but turns my 55 second script into a 20 minute script and that is too long.

I don't know how I could be using the WHEN statement incorrectly.  I've written code exactly like this in 7.5 and 10.0 without this problem.

Former Member
0 Likes

FOR/NEXT loop calculates it right because it overrides previous postings.

In WHEN/ENDWHEN records are accumulated, so if you have same member multiple times it will add them up. In your script this can happen to ENTITY Dimension only.

Former Member
0 Likes

Right, that makes sense.  I've cleared the intersections for that ENTITY however, so there is only one intersection with data.  I placed 500 in that intersection via an input schedule.  Then I run the script and it places 1500 in the destination intersection.  Since there is only one intersection in the model for that Entity, I don't know what it would be adding.

Former Member
0 Likes

I tried another entity and the same problem exists.

It seems that I have 3 Entity members that are related to the problem.  Even though there is no data stored in those members, if they are included within the scope, then the data is tripled.  I removed one of the members because it was a test member and now my data always doubles.  I cannot remove the other two since they are required.

Former Member
0 Likes

I'm not sure I follow you.  I shouldn't have to use ENTITY within the WHEN statement.  In fact, I don't want to because I actually have some additional REC in the actual script (not the test script) that saves the value to a different ENTITY.  If I used *WHEN ENTITY, then it would sum all of the values and store in the target ENTITY which I don't want.

I have tried a FOR loop and it seems to fix the problem, however as stated in the original post, it makes my 55 second script take about 20 minutes.  That's a huge difference that the customer doesn't want.