Skip to Content
0

script logic lookup and rec expression

Nov 24, 2016 at 12:35 PM

75

avatar image

Hi BPC Friend

I am in trouble to understand the meaning of the three rows in bold

*SELECT(%MYTIME%,ID,TIME,BUD_FCST_DRS=IN_BPF)

*LOOKUP Reporting

*DIM FLAG1000:ACCOUNT="FL1000"

*DIM FLAG1000:FLOW="F_CLO"

*DIM PGIND1000:ACCOUNT="ROY_005"

*DIM PGIND1000:FLOW="PUB_GROUP"

*DIM PGDEP1000:ACCOUNT="ROY_005"

*DIM PGDEP1000:PRODUCTGRP="ALL_PRODGRPS"

*DIM PGDEP1000:FLOW="PUB_GROUP"

*DIM FLAG1005:ACCOUNT="FL1005"

*DIM FLAG1005:FLOW="F_CLO"

*DIM PGIND1005:ACCOUNT="ROY_001"

*DIM PGIND1005:FLOW="PUB_GROUP"

*DIM PGDEP1005:ACCOUNT="ROY_001"

*DIM PGDEP1005:PRODUCTGRP="ALL_PRODGRPS"

*DIM PGDEP1005:FLOW="PUB_GROUP"

*ENDLOOKUP

*XDIM_MEMBERSET CATEGORY=NYBUDGET

*XDIM_MEMBERSET CHANNEL=NO_CHANNEL

*XDIM_MEMBERSET COSTCATEGORY=NO_COSTCAT

*XDIM_MEMBERSET DATASRC=IN_BPF

*XDIM_MEMBERSET ENTITY=%ENTITY_SET%

*XDIM_MEMBERSET FLOW=BAS(PUB_GROUP),PUB_GROUP,F_CLO

*XDIM_MEMBERSET GROUPS=G_NONE

*XDIM_MEMBERSET INTCO=I_NONE

*XDIM_MEMBERSET PRODUCTGRP=BAS(ALL_PRODGRPS)

*XDIM_MEMBERSET RPTCURRENCY=LC

*XDIM_MEMBERSET TIME=%MYTIME%

*WHEN_REF_DATA=MASTER_DATA

*WHEN ACCOUNT

*IS FL1000

*WHEN FLOW

*IS F_CLO

*WHEN PRODUCTGRP

*IS<>PG_8001

*REC(EXPRESSION=(LOOKUP(FLAG1000)==1&&LOOKUP(PGIND1000)==0)?1:2,ACCOUNT=CL1000)

*REC(EXPRESSION=(LOOKUP(FLAG1000)==2&&LOOKUP(PGIND1000)!=0)?1:2,ACCOUNT=CL1000)

*REC(EXPRESSION=-2,ACCOUNT=CL1000)

*ELSE

*REC(EXPRESSION=(LOOKUP(FLAG1000)==1&&LOOKUP(PGDEP1000)==0)?1:2,ACCOUNT=CL1000)

*ENDWHEN

*ENDWHEN

*ENDWHEN

*COMMIT

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Vadim Kalinin Nov 24, 2016 at 12:45 PM
0

I am not a cryptanalyst to explain what was the idea of the code author :) I don't even know if it's a working code or not!

You have to explain the logic to be achieved and I will help with the code.

Just about syntax:

*DIM FLAG1000:ACCOUNT="FL1000"
*DIM FLAG1000:FLOW="F_CLO"

means that LOOKUP label FLAG1000 has the mentioned dimensions scoped.

*REC(EXPRESSION=(LOOKUP(FLAG1000)==1&&LOOKUP(PGIND1000)==0)?1:2,ACCOUNT=CL1000)

If (LOOKUP(FLAG1000)=1 AND LOOKUP(PGIND1000)=0) then result=1 else result=2

And result will be stored in ACCOUNT=CL1000

Show 9 Share
10 |10000 characters needed characters left characters exceeded

perfect Vadmin, I understood very well your answer.

I found this code, I haven't written it.

I didn't know that the variable Flag1000 could have more dimension-member.

What about the other dimensions? which member the lookup will check? for which other member the rec will write the value 1 or 2?

If (LOOKUP(FLAG1000)=1 AND LOOKUP(PGIND1000)=0) then result=1 else result=2

0

"What about the other dimensions? which member the lookup will check?" - if member is not provided in the lookup label then it will be from the current record of when/endwhen loop.

Is it clear?

P.S. The code itself is not very professional -for example:

*XDIM_MEMBERSET FLOW=BAS(PUB_GROUP),PUB_GROUP,F_CLO

...

*WHEN FLOW

*IS F_CLO

What for to scope BAS(PUB_GROUP),PUB_GROUP??????

1

P.S. Flag1000 is not a variable, it's a lookup label with some scope related to it.

1

thanks Vadim

you said:

"What about the other dimensions? which member the lookup will check?" - if member is not provided in the lookup label then it will be from the current record of when/endwhen loop. Is it clear?

so it means that (tell me if I am right), according the code below BPC will create a new record writing 1 or 2 for the account CL1000 F_CLO and the other member like the record that is being analysed by when

*WHEN ACCOUNT

*IS FL1000

*WHEN FLOW

*IS F_CLO

*WHEN PRODUCTGRP

*IS<>PG_8001

*REC(EXPRESSION=(LOOKUP(FLAG1000)==1&&LOOKUP(PGIND1000)==0)?1:2,ACCOUNT=CL1000)

0

Yes, something like...

You have also special statement:

*WHEN_REF_DATA=MASTER_DATA

it will loop all scope master data independent on existing records...

1

thanks Vadim.

I have another two questions:

what does the following mean?

*WHEN_REF_DATA=MASTER_DATA

the second question, according the below code, my record could fall as true in the first expression writing 1 or 2 and surely will be true the last expression writing -2.

How does it work?

*WHEN ACCOUNT

*IS FL1000

*WHEN FLOW

*IS F_CLO

*WHEN PRODUCTGRP

*IS<>PG_8001

*REC(EXPRESSION=(LOOKUP(FLAG1000)==1&&LOOKUP(PGIND1000)==0)?1:2,ACCOUNT=CL1000)

*REC(EXPRESSION=(LOOKUP(FLAG1000)==2&&LOOKUP(PGIND1000)!=0)?1:2,ACCOUNT=CL1000)

*REC(EXPRESSION=-2,ACCOUNT=CL1000)

*ELSE

0

what does the following mean?

*WHEN_REF_DATA=MASTER_DATA

WHY NOT TO SEARCH YOURSELF?????????????????????????????????

0

The result of 3 expressions will be written to the same intersection ACCOUNT=CL1000

There result will be aggregated = result1 + result2 +result3

1
Show more comments
Vadim Kalinin Nov 24, 2016 at 03:08 PM
0

WHEN/ENDWHEN always aggregate values written to the same destination.

And commit has absolutely no relation to when/endwhen loop (used only with MDX calculations, not with when/endwhen).

You have to spend some time working with some test code in UJKT to understand basic things...

Show 2 Share
10 |10000 characters needed characters left characters exceeded

thanks a lot Vadim

0
1