cancel
Showing results for 
Search instead for 
Did you mean: 

Script Logic problem - default.lgf

Former Member
0 Kudos

Hi

I have an input schedule and when I saved the data, I need to derive values (year month) to another dimension (Year) (which will be used for annual planning).

BPC 10.0

input schedule 1:

             Year    0001      0001       0001            0001

Product Time 2017.01, 2017.02, 2017.03 .... 2018.01, 2018.02

B

C

D

My default.lgf:

* XDIM_MEMBERSET TIME =% TIME_SET%

* XDIM_MEMBERSET YEAR =% YEAR_SET%

* WHEN YEAR

   * IS "0001"

   * FOR% TP =%%% TIME_SET

     * SELECT (% YEAR2%, [YEAR], TIME, ID =% TP%)

     * REC (EXPRESSION =% VALUE% YEAR =% YEAR2%)

   * NEXT

* ENDWHEN

* COMMIT

ERROR

Error executing logical proposal ()

Memb. "" Does not exist

I want to replace the value in the year 0001 for the "year.month" inserted.

   note: input schedule has one or more periods .example from 2017.01 to 2019.01

Thanks and Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Kudos

Sorry, but you have to read some basic documents (at least help) about script logic.

No space between "*" and statement!

*SELECT can't be used inside *FOR/*NEXT

* FOR% TP =%%% TIME_SET - absolutely strange!

*COMMIT is useless here

etc...

Please read also:

to clearly explain your requirements.

Former Member
0 Kudos

Hi Vadim

Sorry, it happened when i have copied and pasted.

Okay, I understand your comments. Did you understand my question?

- "Select" command: I need to increment the "year month" to get the corresponding attribute value (year).

- Ex. The user insert value to 2017.01 i need to get 2017... insert value 2018.04 i get 2018 and insert into dimension "year"

* Using "SELECT" inside "FOR/*NEXT"  and  TMVL(1,%TIME_SET%), it is working fine "when inserted 2 month" ..example:  2017.01 and 2018.04  but when i have more one month,the script is not working. 

*XDIM_MEMBERSET YEAR = %YEAR_SET%

*FOR %TP%=%TIME_SET%

*SELECT(%YEAR2%,[YEAR],TIME,ID = TMVL(1,%TIME_SET%))

*WHEN YEAR

*IS "0001"

*REC(EXPRESSION = %VALUE%,YEAR=%YEAR2%)

*ENDWHEN

*NEXT

*COMMIT

Thanks.

former_member200327
Active Contributor
0 Kudos

Using *SELECT inside *FOR/*NEXT loop is possible, but only if variable name is changing. Since you have fixed variable name (not dependent of FOR/NEXT variable) you'll get error about multiple definitions of same variable.

I still can't understand what you are trying to achieve, but it looks like if you just have YEAR = TIME.YEAR in your REC statement then you don't need those SELECT statements.

Former Member
0 Kudos

Hi Gersh

Please, check my last reply to Vadim.

Thanks.

former_member186338
Active Contributor
0 Kudos

Yes, YEAR=TIME.YEAR will do the job, but the idea to use special dimension for YEAR is strange.

Vadim

Former Member
0 Kudos

Vadim

YEAR dimension will be used for annual planning (using same aggregated data "year.month").

Do you know any solution?

Thanks

former_member186338
Active Contributor
0 Kudos

Separate dimension for annual planning? Absolutely strange idea!

You can use some month or just INP member in the TIME dimension!

Vadim

former_member186338
Active Contributor
0 Kudos

Hi Gersh,

As far as I remember SELECT is simply processed before FOR/NEXT processing!

I have tested the simple script with changing variable name and it's not working:

*SELECT(%TIDS%,[TIMEID],TIME,[ID]=%TIME_SET%)

*SELECT(%TS%,[ID],TIME,[ID]=%TIME_SET%)

*FOR %TID%=%TIDS% AND %T%=%TS%

*SELECT(%Y_%TID%%,[YEAR],TIME,[ID]=%T%)

*XDIM_MEMBERSET TIME=%Y_%TID%%.01

*NEXT

Vadim

former_member200327
Active Contributor
0 Kudos

Hi Vadim,

No, SELECT and FOR/NEXT are processed in same parsing phase. This was working in BPC NW 7.0, but if you have OSS Note 2195744 implemented it seems having a bug. I'll try contacting developer to fix it.

Also, I used %Y_%%TID% rather than %Y_%TID%% because then it didn't depend in what order variables are substituted.

Sorry for misleading advice.

Gersh

P.S. Checked again. What was working is SELECT inside a nested  FOR/NEXT loop, but now value of %% variables are not substituted until *NEXT is reached, but Master Data in SELECT is retrieved as soon as that SELECT is processed. So, yes, SELECT is processed before FOR/NEXT.

former_member186338
Active Contributor
0 Kudos

Hi Gersh,

I do not understand the logic of %Y_%%TID%...

But I tested it (copy of the environmentshell) CPMBPC 800 SP 14 without OSS Note 2195744:

TIME=2014.01,2015.02,2015.04

*SELECT(%TIDS%,[TIMEID],TIME,[ID]=%TIME_SET%)

*SELECT(%TS%,[ID],TIME,[ID]=%TIME_SET%)

*FOR %TID%=%TIDS% AND %T%=%TS%

*SELECT(%Y_%%TID%,[YEAR],TIME,[ID]=%T%)

*XDIM_MEMBERSET TIME=%Y_%%TID%.01

*NEXT

Same result (after Execute):

LGX:

*XDIM_MEMBERSET TIME=%Y_%%TIDS%.01

-------------------------------------------------------------------------------------------------------------------------------------

LOG:

FILE:\ROOT\WEBFOLDERS\ENV1 \ADMINAPP\PERIODPLAN\TEST.LGF

USER:V.KALININ

APPSET:ENV1

APPLICATION:PERIODPLAN

UJK_VALIDATION_EXCEPTION:Member ".01" not exist

Vadim