Hello experts,
I am doing a calculation using script Logic.
What I need to do is to calculate Salary 1 based on Salary0 multipied by KPI, the things is that the KPI is captured by building (hotel) and so did the next script:
//SCOPE
*XDIM_MEMBERSET CATEGORIA = Real
*XDIM_MEMBERSET MONEDA = NA_MONEDA
*XDIM_MEMBERSET CUENTAS= 0000611010
*XDIM_MEMBERSET ZRELACIONCTACEBE= NA_ZREL
*XDIM_MEMBERSET ZSTAGL= NA_ES
*XDIM_MEMBERSET SOCIEDAD= %SOCIEDAD_SET%
*XDIM_MEMBERSET OP_SUPUESTOS= NA_SUP
*XDIM_MEMBERSET HOTEL= %HOTEL_SET%
//Select december and year where the KPIs are sotred
*SELECT(%YRS%,"[YEAR]",PERIODO,"[ID]='%PERIODO_SET%'")
*SELECT(%MNTH12%,"[ID]",PERIODO,"[YEAR]='%YRS%' AND [PERIOD]='DEC'")
*SELECT(%YR%,"[YEAR]",PERIODO,"[ID]='%MNTH12%'")
//SCOPE DEC where the KPIs are stored
*XDIM_MEMBERSET PERIODO= 12.%YR%
*WHEN SUPNOM // CALCULATE SD1 based on SDI0
*IS SDI0
*WHEN MONEDA
*IS MXN
*FOR %T%= 01.%YR%, 02.%YR% ,03.%YR%, 04.%YR%, 05.%YR%, 06.%YR%, 07.%YR%, 08.%YR%, 09.%YR%, 10.%YR%, 11.%YR%, 12.%YR%
*FOR %H% = %HOTEL_SET%
*REC(EXPRESSION=%VALUE%*([PERIODO].[%YR%],[SOCIEDAD].[NA_CCC],[CATEGORIA].[Real],[CeBe].[NA_CeBe],[CECO].[NA_CECO],[CUENTAS].[NA_ACC],[MONEDA].[MXN],[OP_RRHH].[NA_RH],[SUPNOM].[NA_SUPRH],[ZSTAGL].[NA_ES],[ZRELACIONCTACEBE].[NA_ZREL],[OP_SUPUESTOS].[SSDI],[HOTEL].[%H%]), MONEDA="MXN",PERIODO=%T%)
*NEXT
*NEXT
*ENDWHEN
*ENDWHEN
The problem in the previous script is that it works when the %HOTEL_SET% is just one building, ie BUILDING1, but if the user selects BUILDING1 and BUILDING2 the script gets all messed up this is bc the *FOR is made twice 1 for BUILDING1 and 2 for BUILDING2 which are in the scope,
What can I do to validate that the script do the for just for the BUilding where the info should be stored and (the difference is by Salary and not by buildint).
Any Ideas
Thnaks for the post,
Best regards