cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering Script Logic based on property

0 Kudos

Hi All,

I have developed a script logic (RECLASS) , which I want to run only when a property of TIME dimension ( DAY_YEAR)  has value "R" in it. This value could be under any TIME ID.

Below syntax is not working, but will give you an idea of what I am trying to accomplish. Does anyone know how to achieve following with correct syntax?

*SELECT(%Z%,"ID","TIME","[DAY_YEAR] = "R"")

*WHEN %Z%

*IS <> " "

*INCLUDE RECLASS.LGF

*ENDWHEN

Thanks,

S

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Sorry. but absolutely not clear what do you want to achieve: "when a property of TIME dimension ( DAY_YEAR)  has value "R" in it"

What member of time dimension????

And the syntax is incorrect...

0 Kudos

Hi Vadim,

What I am checking is that there should be a value R assigned to property DAY_YEAR of time dimension. It doesn't matter which time period it is assigned to. I want to  execute a script only if there is R in the property. If none of  the time members has DAY_YEAR property marked as R , then I don't want to run the logic.

I pasted incorrect syntax just to show what I want to accomplish. Here is dummy logic

IF any member of time dimension has DAY_YEAR Property =R

then Run RECLASS script

Otherwise do nothing.

or

Following is my RECLASS script which I don't want to execute if DAY_YEAR property does't have R value in any period. I am passing Time period through DM package.

*XDIM_MEMBERSET FSI = FSI1030100, FSI1120100, FSI1120200, FSI2012420, FSI2012435, FSI2012425

*XDIM_MEMBERSET CATEGORY = ACTUAL

*XDIM_MEMBERSET SCOPE = S_NONE

*XDIM_MEMBERSET AUDITTRAIL = AT_ICDIFF

*XDIM_MEMBERSET FLOW = F_ICDIFF

*SELECT(%C%,"ID","TIME","[DAY_YEAR] = "R"")

*WHEN TIME

*IS < %C%

*REC(EXPRESSION = 0)

*ENDWHEN





Thanks,

S

former_member186338
Active Contributor
0 Kudos

"I am passing Time period through DM package." then TIME periods will be in %TIME_SET%

"I want to  execute a script only if there is R in the property"

Your script will be:

*XDIM_MEMBERSET FSI = FSI1030100, FSI1120100, FSI1120200, FSI2012420, FSI2012435, FSI2012425

*XDIM_MEMBERSET CATEGORY = ACTUAL

*XDIM_MEMBERSET SCOPE = S_NONE

*XDIM_MEMBERSET AUDITTRAIL = AT_ICDIFF

*XDIM_MEMBERSET FLOW = F_ICDIFF

*XDIM_MEMBERSET TIME=%TIME_SET%


*WHEN TIME.DAY_YEAR

*IS R 

  *REC(EXPRESSION = 0) //only for members with R

*ENDWHEN

former_member186338
Active Contributor
0 Kudos

P.S. Sample with different logic - with R and without R:

*WHEN TIME.DAY_YEAR

*IS R 

  *REC(EXPRESSION = 0) //only for members with R

*ELSE

  *REC(EXPRESSION = 5) //only for members without R

*ENDWHEN

0 Kudos

Vadmin,

Thanks for your effort in trying to help me:

I  do not want to run the script either for periods with R or without R, but I want to run script only when there is any R. e.g R is marked on 2015.03, and I pass 2014.01 to DM package, then I would like to run script on 2014.01

If there is no R in any period, and I pass 2014.01 then I don't want to run the script.

Hope this clarifies what I am looking for

Thanks,

S

former_member186338
Active Contributor
0 Kudos

Well, there is no conditional execution of code in script logic!

You can simulate it but you have to confirm conditions:

1. Zero or one or many periods can be marked by R

2. If not zero are marked then execute some code once!

Is it correct?

former_member186338
Active Contributor
0 Kudos

Assuming that multiple periods can be marked by R (all - base members) then the following code will simulate if:

*SELECT(%C%,CALC,TIME,DAY_YEAR=R) //%C% will contain one or more "N" or Empty

*SELECT(%P%,ID,TIME,CALC=%C% AND ID=2010.01) //%P% will contain 2010.01 or Empty

*FOR %T%=%P%

//Your code here - If %P% is empty - not executed!

*NEXT

0 Kudos

Vadin,

For statement gave me idea to use the following code. Thanks for that. Now the code will not run if "R" is not assigned to a period.

Next thing to solve in the code is to not run it if "R" is assigned to more than one period. I want to run code only when only one period is marked as R and this period could be any period.

Do you have any suggestion on that?

*XDIM_MEMBERSET FSI = FSI1030100, FSI1120100, FSI1120200, FSI2012420, FSI2012435, FSI2012425

*XDIM_MEMBERSET CATEGORY = ACTUAL

*XDIM_MEMBERSET SCOPE = S_NONE

*XDIM_MEMBERSET AUDITTRAIL = AT_ICDIFF

*XDIM_MEMBERSET FLOW = F_ICDIFF

*XDIM_MEMBERSET TIME = %TIME_SET%

*SELECT(%C%,"ID","TIME","[DAY_YEAR] = "R"")

*FOR %L% = %C%

  *WHEN TIME

  *IS < %L%

  *REC(EXPRESSION = 0)

  *ENDWHEN

*NEXT

*COMMIT

Thanks,

S

former_member186338
Active Contributor
0 Kudos

Please confirm:

Not assigned at all - not run

Assigned to single period - run

Assigned to more than single period - not run

former_member186338
Active Contributor
0 Kudos

P.S. This code is incorrect:

*FOR %L% = %C%

  *WHEN TIME

  *IS < %L%

  *REC(EXPRESSION = 0)

  *ENDWHEN

*NEXT

*COMMIT

0 Kudos

Vadin,

You are correct. Following three conditions are correct.

Not assigned at all - not run

Assigned to single period - run

Assigned to more than single period - not run

Thanks,

S

0 Kudos

Vadin,

What issue do you see in the code above? I ran it and it is running successfully. I have to test it thoroughly though. I did quick test in UJKT and through DM package and things looked fine.

Thanks,

S

former_member186338
Active Contributor
0 Kudos

%TIME_SET%=2014.01

R is marked on 2015.03,2015.02

The code will run twice

%TIME_SET%=2016.01

R is marked on 2015.03

The code will not run

%TIME_SET%=2015.03

R is marked on 2015.03

The code will not run

Etc...

Compare with conditions!

former_member186338
Active Contributor
0 Kudos

For 3 conditions:

*SELECT(%T%,TIMEID,TIME,DAY_YEAR=R)

*SELECT(%P%,ID,TIME,TIMEID<=%T% AND CALC=N)

*SELECT(%C%,ID,TIME,ID=%P% AND TIMEID>=%T% AND CALC=N)

*FOR %L%=%C%

/Your code here - If %C% is empty - not executed!

*NEXT

If 2 or more members are marked with R %C% will be empty.

If none is marked with R %C% will be empty.

If single member marked with R %C% will contain the ID of this member

former_member186338
Active Contributor
0 Kudos

Even better, without TIMEID:

*SELECT(%T%,ID,TIME,DAY_YEAR=R)

*SELECT(%P%,ID,TIME,ID<=%T%)

*SELECT(%C%,ID,TIME,ID=%P% AND ID>=%T%)

*FOR %L%=%C%

//Your code here - If %C% is empty - not executed!

*NEXT

0 Kudos

Vadin,

What is the nature of following selection when there are more than two %T% values that might be random periods?

*SELECT(%P%,ID,TIME,ID<=%T%)


I am testing this syntax in UJKT and it is not consistent in case of multiple values of T.


Thanks,

Sanjeev

former_member186338
Active Contributor
0 Kudos

Sorry, please test again!

Use code like here (XDIM_MEMBERSET in the loop just to check)

*SELECT(%T%,ID,TIME,DAY_YEAR=R)

*SELECT(%P%,ID,TIME,ID<=%T%)

*SELECT(%C%,ID,TIME,ID=%P% AND ID>=%T%)

*FOR %L%=%C%

//Your code here - If %C% is empty - not executed!

*XDIM_MEMBERSET TIME=%L%

*NEXT

It's 100% consistent, just tested with 3 members marked with R:

*SELECT(%T%,ID,TIME,DAY_YEAR=R)

%T%=2015.05,2015.07,2015.10

*SELECT(%P%,ID,TIME,ID<=%T%)

%P%=...2015.04,2015.05

ID>=%T% - 2015.10,2015.11,2015.12...

*SELECT(%C%,ID,TIME,ID=%P% AND ID>=%T%)

%C% - empty

Only with single member marked by R

%T%=2015.05

*SELECT(%P%,ID,TIME,ID<=%T%)

%P%=...2015.04,2015.05

ID>=%T% - 2015.05,2015.06,2015.07...

*SELECT(%C%,ID,TIME,ID=%P% AND ID>=%T%)

%C%=2015.05

0 Kudos

Vadin,

I think following syntax gives all the periods in %P% or >=%T%. I think because AND condition is not valid when both properties are same ( ID in this case ) . In such cases AND behaves like OR

*SELECT(%C%,ID,TIME,ID=%P% AND ID>=%T%)

I testes this in UJKT and seems AND is not working.

Thanks,

Sanjeev

former_member186338
Active Contributor
0 Kudos

It depends on BPC SP you have, please provide full details about your BPC and BW version and SP

former_member186338
Active Contributor
0 Kudos

And you can always use the code with TIMEID

0 Kudos

Vadin,

BPC is on 801 10

BW is on  740 13

Thanks,

Sanjeev

former_member186338
Active Contributor
0 Kudos

I have tested it on BPC 800 14 (BW 730 12) - working correctly (both versions).

Please show UJKT screenshot - what are you testing?

former_member186338
Active Contributor
0 Kudos

Also tested on BPC 801 13 (BW 740 14) - no issues!

0 Kudos

Vadin,

Thank you very much for providing the solution. I really appreciate your time on this.

Sanjeev

Answers (0)