cancel
Showing results for 
Search instead for 
Did you mean: 

two questions on script logic

Former Member
0 Kudos

Hi all,

I know I can use nested *WHEN statements such as

*WHEN ACCOUNT

*IS A

*WHEN CATEGORY

*IS XY

*REC

*ENDWHEN

*ENDWHEN

But should nested *WHEN statements such as this one work?

*WHEN ACCTDETAIL

*IS F_CLO

*WHEN SIGNEDDATA

*IS < 0

*WHEN ACCTDETAIL

*IS F_OPE

*WHEN SIGNEDDATA <0

*REC

*ENDWHEN

*ENDWHEN

*ENDWHEN

*ENDWHEN

And secondly, if I use *WHEN SIGNEDDATA with three cases:

*WHEN ACCTDETAIL

*IS F_CLO

*WHEN SIGNEDDATA

*IS < 0

*REC

*IS = 0

*REC

*IS > 0

*REC

*ENDWHEN

*ENDWHEN

would the case where there is no entry in the fact table for F_CLO (for example after an optimisation of because no data has been entered) be captured by the *IS = 0 or do I need an *ELSE?

Thanks,

Arnold

Accepted Solutions (1)

Accepted Solutions (1)

former_member186498
Active Contributor
0 Kudos

Hi Arnold,

for the first question I don't think it will work, you must try, but you can rewrite the test in a more simple way

*WHEN SIGNEDDATA

*IS < 0

  *WHEN ACCTDETAIL

  *IS F_CLO

     ...

  *IS F_OPE

     ...

  *ENDWHEN

*ENDWHEN

for the second there are nested *WHEN,  that means that the Signeddata tests are inside the Accdteail test so you need and *ELSE.

Kind regards

     Roberto

Former Member
0 Kudos

Hi Roberto,

My script above was a shortened example. Let's say I have to members in my ACCTDETAIL dimension, F_CLO and F_OPE and each can be a positive or negative value or a zero value. What I am looking to do with my script is to check for each possible combination

F_CLO   F_OPE

0           0

0           +

0           -

+           0

+           +

+           -

-            0

-            +

-             -

So my idea was to check for F_CLO = 0 first and then each of the possible values of F_OPE. I have tested this idea and it doesn't work so I've come up with a different solution.

Thanks,

Arnold

former_member186498
Active Contributor
0 Kudos

Hi Arnold,

adding to the Kaarthic answer, if you have the same REC for the 2 AccDetail you can use an *XDIM_MEMBERSET F_CLO, F_OPE and after just test

*WHEN SIGNEDDATA

*IS < 0

*REC

*IS = 0

*REC

*IS > 0

*REC

*ENDWHEN

Kind regards

     Roberto

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Arnold,

For the first case, the script is trying to check if a record has two members within a dimension-ACCTDETAIL. This is not possible. However you can try using

  • *WHEN GET(ACCTDETAIL="F_CLO")
  • *IS 0.....

For the second case, you must use *ELSE to proceed further, since there are no records to compare with signeddata.

Karthik AJ

JohnL
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can also combine the GET in a WHEN using a + operator:

i.e.

*WHEN GET(ACCTDETAIL="F_CLO")+GET(ACCTDETAIL="F_OPE")
*IS > 0

*IS < 0

*IS 0

*ENDWHEN

Also note that you need to consider the ACCTYPE of the accounts you are scoping since INC/LEQ accounts are stored as negative values in the database.

Remember there are many way to skin a cat with BPC script logic

Thanks,

John

Former Member
0 Kudos

Thanks John.

The usage of + operator seems really cool to use.

I never tried that before. May be I have not faced such requirement yet.

Learnt a new thing.

Karthik AJ