Skip to Content
0
Former Member
May 28, 2013 at 03:48 AM

BPC NW 10: getting wrong amounts on records (script logic)

17 Views

hi bpc gurus:

I have a situation on my script logic, this is what happens : I have some records in campaigns (Time = 2015.C01 .... 2015.C18) and I need to convert them to months (Time= 2015.01 .... 2015.12) through a factor which is saved in other model. I built my script logic using a lookup function like this:

*LOOKUP FI_VariablesGlobales

*DIM FAC_ENERO:CUENTA = ZPARM014 //(every ZPARM0XX save the factor to convert campaign to month)

*DIM FAC_FEBRERO:CUENTA = ZPARM015

*DIM FAC_MARZO:CUENTA = ZPARM016

*DIM FAC_ABRIL:CUENTA = ZPARM017

*DIM FAC_MAYO:CUENTA = ZPARM018

*DIM FAC_JUNIO:CUENTA = ZPARM019

*DIM FAC_JULIO:CUENTA = ZPARM020

*DIM FAC_AGOSTO:CUENTA = ZPARM021

*DIM FAC_SETIEMBRE:CUENTA = ZPARM022

*DIM FAC_OCTUBRE:CUENTA = ZPARM023

*DIM FAC_NOVIEMBRE:CUENTA = ZPARM024

*DIM FAC_DICIEMBRE:CUENTA = ZPARM025

*DIM GRUPOCAT = GC_NONE

*DIM MARCA = MA_NONE

*DIM MONEDA = MON_NONE

*DIM SOCRELACIONADA = SR_NONE

*DIM TIPORATIO = TR_NONE

*ENDLOOKUP

and it works fine.

What happens next is that I do a *FOR and a *WHEN to process every line of info in campaigns (for example: 2015.C01,2015.C02,2015.C03)

but some campaigns have a factor for the same month, for example:

100% of C01 goes to January (ENERO) : assume a final value of 100

80% of C02 goes to January (ENERO) : assume a final value of 200

20% of C02 goes to February (FEBRERO) assume a final value of 300

100% of C03 goes to February (FEBRERO) assume a final value of 400

So I expect to get this:

January = 300

February = 700

What the script is doing is:

January = 200

February = 400

Just keep the last record, how can I solve this? In order to have the right values...

This is part of my script logic:

*FOR %CAMP% = 2015.C01,2015.C02,2015.C03

*WHEN TIEMPO

*IS %CAMP%

*REC(EXPRESSION = (( LOOKUP(FAC_ENERO) ) * %VALUE% ), TIEMPO = 2015.01, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_FEBRERO) ) * %VALUE% ), TIEMPO = 2015.02, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_MARZO) ) * %VALUE% ), TIEMPO = 2015.03, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_ABRIL) ) * %VALUE% ), TIEMPO = 2015.04, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_MAYO) ) * %VALUE% ), TIEMPO = 2015.05, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_JUNIO) ) * %VALUE% ), TIEMPO = 2015.06, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_JULIO) ) * %VALUE% ), TIEMPO = 2015.07, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_AGOSTO) ) * %VALUE% ), TIEMPO = 2015.08, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_SETIEMBRE) ) * %VALUE% ), TIEMPO = 2015.09, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_OCTUBRE) ) * %VALUE% ), TIEMPO = 2015.10, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_NOVIEMBRE) ) * %VALUE% ), TIEMPO = 2015.11, SECCIONORIGEN = SN_VYCMES )

*REC(EXPRESSION = (( LOOKUP(FAC_DICIEMBRE) ) * %VALUE% ), TIEMPO = 2015.12, SECCIONORIGEN = SN_VYCMES )

*ENDWHEN

*NEXT

PS: is it ok to have several *REC in a script logic?

best regards

jav