Skip to Content
avatar image
Former Member

BPC 7.5 Script Logic - If / Then logic

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 19, 2014 at 02:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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