cancel
Showing results for 
Search instead for 
Did you mean: 

BPC 7.5 Script Logic - If / Then logic

Former Member
0 Kudos

Hi

We are currently on BPC 7.5  NW and are trying to update some of script logic be be a bit more dynamic.  During a couple of weeks a year we need to run some script logic in a script.  We were hoping to be able to alter the code so that if we set some variable, or put a value in a dimension then it would run a couple of lines of code.   Has anyone ever tried to do this?

Idea would be something like:

 

//*******************Create variables************************

//select the time filters

*SELECT (%CUR_PERIOD%, "[ID]", "TIME", "CURRENT_YEAR='C'")

*SELECT (%FURTURE_PERIOD%, "[ID]", "TIME", "CURRENT_YEAR='F'")

//pull actual current version

*SELECT(%CURR_VERSION%, "ACTUAL_VERSION", "VERSIONBASE", "[ID]='ACTUAL'")

//CMRAW - only select CSL relevant materials

*SELECT(%CSL_REL%, "[ID]", CMRAW, "[CSL_RELEVANT]='N' AND [RPTRAW]<>''")

//ensure that you are selecting only those that have a a profit group / GPH assigned to them

*SELECT(%FINSC%, "[ID]", FIN, "[RPTFIN_ID]<>'' AND [RPTFIN]<>''")

//this is needed since during VOL_refresh and SP you have a statement that needs to grab both Y and N

*SELECT(%CSL_REL_ALL%, "[ID]", CMRAW, "[RPTRAW]<>''")

*SELECT(%SPRING_PLAN%, "SPRING_PLANT", CMRAW, "[ID]="SPRING_PLAN'")

//************************************************************

 

//*************************

//Intmktcovspend CURRMMO

//*************************

IF %SPRING_PLAN% = "YES" THEN

     *XDIM_MEMBERSET CMRAW= %CSL_REL%

     *XDIM_MEMBERSET CURRENCY=USD

     *XDIM_MEMBERSET CMACCT=A_INTMKTCOVSPND

     *XDIM_MEMBERSET CMDATASRC=DS_INPUT

     *XDIM_MEMBERSET VERSIONBASE=CURRMMO

     *XDIM_MEMBERSET TIME= %CUR_PERIOD%,%FURTURE_PERIOD%

     *XDIM_MEMBERSET FIN=%FINSC%

     *XDIM_MAXMEMBERS TIME=1

 

     *DESTINATION_APP = REPORTING

     *ADD_DIM DATASRCRPT=DS_CMFEED, VERSIONCOMP=VCNONE, ACCTRPT=A_INTMKTCOVSPND

     *RENAME_DIM CMACCT=PROFIT_HIER, FIN=FINRPT, CMDATASRC=RAW_OWNER

     *WHEN FIN

     *IS *

     *REC(EXPRESSION=%VALUE%,CMACCT=FIN.RPTFIN_ID,CMDATASRC=CMRAW.RPTRAW,FIN=FIN.RPTFIN)

     *ENDWHEN

END IF

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Hi Jennifer,

Script logic don't support conditional code execution!

Can you describe the calculation logic you want to implement (in some simple form) then I may be able to provide a solution!

Vadim

Former Member
0 Kudos

We have a couple of examples

1) during our Plan time we need to run with Prior year and current year

 

//***************************during spring plan you must add in section TIME=LU-TIME.PRYEAR****************************************

*DESTINATION_APP = REPORTING

*ADD_DIM DATASRCRPT=DS_PROXY, VERSIONCOMP=VCNONE, ACCTRPT=A_INTMKTCOVSPND

*RENAME_DIM CMACCT=PROFIT_HIER, FIN=FINRPT, CMDATASRC=RAW_OWNER

*WHEN FIN

*IS *

*REC(EXPRESSION=%VALUE%,CMACCT=FIN.RPTFIN_ID,CMDATASRC=CMRAW.RPTRAW,FIN=FIN.RPTFIN)

*ENDWHEN

2) We have sections of code that should be run during PLAN but it slows down the job normally so only should run during that time

 

//*************************

//for 2 weeks for vol refresh - can always stay, but can slow things down

//okay to have both CSL Y and N since we are not pushing in CSL

//*************************

//During spring plan and volume refresh for the 2 weeks you need to also inclide DS_INPUT then turn off once we are done

*XDIM_MEMBERSET CURRENCY=USD

*XDIM_MEMBERSET CMACCT=A_INTMKTCOVSPND

*XDIM_MEMBERSET CMDATASRC=DS_INPUT

*XDIM_MEMBERSET VERSIONBASE=%CURR_VERSION%

*XDIM_MEMBERSET TIME= %CUR_PERIOD%

*XDIM_MAXMEMBERS TIME=1

*XDIM_MEMBERSET FIN=%FINSC%

*XDIM_MEMBERSET CMRAW=%CSL_REL_ALL%

//*************************

//ONLY AT SPRING PLAN AND VOLUME REFRESH - Comment back - 09/09/2014

//*************************

*DESTINATION_APP = REPORTING

*ADD_DIM DATASRCRPT=DS_CMFEED, VERSIONCOMP=VCNONE, ACCTRPT=A_INTMKTCOVSPND

*RENAME_DIM CMACCT=PROFIT_HIER, FIN=FINRPT, CMDATASRC=RAW_OWNER

*WHEN FIN

*IS *

*REC(EXPRESSION=%VALUE%,CMACCT=FIN.RPTFIN_ID,CMDATASRC=CMRAW.RPTRAW,FIN=FIN.RPTFIN)

*ENDWHEN

Thank you

former_member186338
Active Contributor
0 Kudos

Sorry Jennifer,

It's really hard to analyze a lot of lines of your code. Can yo describe the logic:

1. What is the user input to run this script?

2. How you want to trigger different calculations: "*SELECT(%SPRING_PLAN%, "SPRING_PLANT", CMRAW, "[ID]="SPRING_PLAN'")" - not clear!

3. Logic in both cases as description - not as code!

Vadim

Former Member
0 Kudos

1) this part of the nightly job so a user does not input any values.  This job runs fully on it's own to calculate our spend

2) Our plan was to set a attribute on a dimension = Yes or No.  If it was YES then when you did the select spring_plan it will pull back a YES.  With that value then we could either compelete a couple of lines of code vs not running it

3a) if we had SPRING_PLAN = YES then we would want to push both current year data and prior year data into the next application

3b) Push a certain intersection of data to the next application only during spring plan time


former_member186338
Active Contributor
0 Kudos

Well, you can use the following trick:

1. The property SPRING_PLAN will have 2 possible values: Empty and Any Character

2. The code will be:

*SELECT(%SPRING_PLAN%, "[SPRING_PLAN]", CMRAW, "[ID]='SPRING_PLAN'")

*FOR %S%=%SPRING_PLAN%

...

//Code to be executed if SPRING_PLAN property is NOT empty

...

*NEXT

For empty property the contents between FOR and NEXT will be skipped.

Vadim

Answers (0)