Skip to Content

Variables for prior and next periods in logic


Hi,

I'd like to do something that I would have thought should be quite simple, but I just haven't managed to get it right.

In Category, we use the properties Year and Month. For example:

Member Year Month

Actual 2014 APR

SP 2016 DEC

The issue is that we would like to create SP (Strategic Plan) for 3 years, of which the year in the property, 2016, is the first.

Creating variables for the month and for the first SP year is simple:

*SELECT(%CYEAR_SP%,"[YEAR]","CATEGORY","[ID]= 'SP'")

*SELECT(%CMONTH_SP%,"[MONTH]","CATEGORY","[ID]= 'SP'")

I'd then like to dynamically create 3 variables based on properties Year and Month; %SP1%, %SP2% and %SP3%, that I can use in scoping, in *WHEN/*IF, in GET and in *REC. It should be something like:

%SP1% = %CYEAR_SP%.%CMONTH_SP% (2016.DEC)

%SP2% = %CYEAR_SP%(+1).%CMONTH_SP% (2017.DEC)

%SP3% = %CYEAR_SP%(+2).%CMONTH_SP% (2018.DEC)

However it doesn't seem possible to use mathematical expressions for this, and I haven't managed to use NEXT or PRIOR successfully either.

Has anybody out there encountered this?

/Cecilia

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jun 12, 2014 at 09:56 AM

    Hi Cecilia,

    try with

    *SELECT(%CYEAR_SP%,"[YEAR]","CATEGORY","[ID]= 'SP'")

    *SELECT(%CYEAR_SP2%,"[YEAR]+1","CATEGORY","[ID]= 'SP'")

    *SELECT(%CYEAR_SP3%,"[YEAR]+2","CATEGORY","[ID]= 'SP'") ....

    Regards

    Roberto

    Add a comment
    10|10000 characters needed characters exceeded

    • Thanks Roberto! Square brackets for Year in *SELECT was the syntax solution, works like a charm!.

      I developed this further by creating new variables concatenating the year and month:

      *SELECT(%SP1%,"[ID]","TIME","[ID]='%CYEAR_SP%.%CMONTH_SP%'")

      *SELECT(%SP2%,"[ID]","TIME","[ID]='%CYEAR_SP2%.%CMONTH_SP%'")

      *SELECT(%SP3%,"[ID]","TIME","[ID]='%CYEAR_SP3%.%CMONTH_SP%'")

      /Cecilia

  • Posted on Jun 12, 2014 at 10:00 AM

    Don't know what you trying to do, but this may help you:

    You can REC a #variable in MS with that data, just concatenate with +

    example:

    *REC(EXPRESSION=1,ACCOUNT="#YEAR2016", TIMEDIM="WHAT YOU WANT" + .DEC)

    Then you can use that variable

    *WHEN ACCOUNT

    *IS "#YEAR2016"

    You cant test this and see if it works for you

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.