Skip to Content
-1
Sep 03, 2018 at 04:58 AM

Lookup in logic script giving incorrect aggregated data

63 Views Last edit Sep 03, 2018 at 05:30 AM 3 rev

Hi,

We are trying to lookup to another model X_PNL from X_PNLACC. With the following logic script mentioned below.

However, the data in X_PNLACC is getting multiplied 4 times to the original value and it is not fetching data at 1020 entity level. Only data at 1010 entity is getting fetched.

Since there are multiple entities too, do I need to create a separate variable for that and loop it in WHEN ?

*SELECT(%EX%,"[ID]","APL_ENTITY","[ENT_ATTR] = 'E'")

*SELECT(%ACC%,"[ID]","APL_ACCOUNTS","[PNL] = 'P'")

*LOOKUP X_PNL

*DIM APL_TIMES = %APL_TIMES_SET%

*DIM APL_KEYFIGURE = "AMT"

*DIM APL_PC = "PC_NONE"

*DIM APL_PRODUCT = "NOPRODUCT"

*DIM APL_CC = "NOCC"

*DIM APL_PLANYEAR = "NOPLANYEAR"

*DIM APL_AUDITTRAIL = "333"

*DIM APL_CURRENCY = "LC"

*DIM APL_CATEGORY = "ACT"

*FOR %V1% = %ACC%

*DIM X_%V1%:APL_ACCOUNTS = %V1%

*NEXT

*ENDLOOKUP

*XDIM_MEMBERSET APL_ACCOUNTS = %ACC%

*XDIM_MEMBERSET APL_TIMES = %APL_TIMES_SET%

*XDIM_MEMBERSET APL_KEYFIGURE = AMT,Dummy_test

*XDIM_MEMBERSET APL_PC = PC_NONE

*XDIM_MEMBERSET APL_PRODUCT = NOPRODUCT

*XDIM_MEMBERSET APL_CC = NOCC

*XDIM_MEMBERSET APL_PLANYEAR = NOPLANYEAR

*XDIM_MEMBERSET APL_AUDITTRAIL = 333

*XDIM_MEMBERSET APL_CURRENCY = LC

*XDIM_MEMBERSET APL_CATEGORY = ACT

*XDIM_MEMBERSET APL_ENTITY = %EX%

*WHEN APL_TIMES *IS %APL_TIMES_SET%

*WHEN APL_ENTITY *IS 1020,1010

*FOR %V2% = %ACC% *REC(EXPRESSION = LOOKUP(X_%V2%),APL_TIMES = %APL_TIMES_SET%,APL_ACCOUNTS = %V2%,APL_KEYFIGURE = Dummy_test) *NEXT

*ENDWHEN

*ENDWHEN