on 2016 Sep 26 9:32 PM
Hello experts,
I am trying to figure out how to count in Script Logic.
I wasreading the next post:
How to use a Count in ScriptLogic | SCN
I use the syntaxis as is described in the post:
*SELECT (%NMEMBERS%, count(),PERIODO, ID=%PERIODO_SET%)
Periodo is my dimension and %PERIODO_SET% is the selection that the user use when running the Data Manager to run this SL.
I got the error "INVALID ATTRIBUTE NAME (count() in Dimension (PERIODO)
What is wrong in the sentence?
Is there another way to count the number of months selected by user in the %PERIODO_SET%?
Thanks for the posts.
Regards
Request clarification before answering.
"count the number of months selected by user in the %PERIODO_SET%" - sorry, but what for???
And for sure select doesn't support syntax with count
P.S. And never try to use solutions proposed for BPC MS in BPC NW
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need to know the number of months selected by user. This is because In the script logic I have, for %T%= %PERIODO_SET% has to do a a calculation, after %PERIODO_SET% it has to be another different calc.
For instance,
The user selects Jan to Aug, (this is Calculation A)
from Aug to Dec, I have to do another Calculation (B).
Is there a way to konw how many months did the user selected or the last element of the selection? that way I think TMVL could be used.
Thanks for the answers
Regards.
The user is going to run the script logic to calculate next Year BUDGET based on real values. The user defined that he will select just the periods with actual Values (real).
Lets say they want to calculate budget today, then Jan to Aug wil be based on 2016 values, since Sept to dec don't have actual values, they want to calculate the average fom jan to aug and place the average fro sept to dec.
that is the definition.
yeap,
I got the first part. This first CALC depens on the account property.
The second part Im working on it. I have an idea how to calculate the average of the rest of the months (well, more less). But I don't know how know get the number of months selected by the user,
They could be Jan to Sep, jan to oct, or jan to nov, because for dec they already need the Budget approved to uplod it to ECC or do the retraction.
Is there a way to count the periods selected in the dimension %TIME_SET%??
Sample:
Let's assume TIME=2016.08
Script:
*SELECT(%Y%,YEAR,TIME,ID=%TIME_SET%)
*SELECT(%MN%,MONTHNUM,TIME,ID=%TIME_SET%)
*SELECT(%ACTPERS%,ID,TIME,ID<=%TIME_SET% AND YEAR=%Y% AND CALC=N)
*SELECT(%AVGPERS%,ID,TIME,ID>%TIME_SET% AND YEAR=%Y% AND CALC=N)
*XDIM_MEMBERSET TIME=%ACTPERS%
*WHEN TIME
*IS *
*FOR %T%=%AVGPERS%
*REC(EXPRESSION=%VALUE%/%MN%,TIME=TMVL(12,%T%))
*NEXT
*ENDWHEN
Resulting LGX in UJKT:
*XDIM_MEMBERSET TIME=2016.01,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07,2016.08
*WHEN TIME
*IS
*REC(EXPRESSION=%VALUE%/8,TIME= 2017.09 )
*REC(EXPRESSION=%VALUE%/8,TIME= 2017.10 )
*REC(EXPRESSION=%VALUE%/8,TIME= 2017.11 )
*REC(EXPRESSION=%VALUE%/8,TIME= 2017.12 )
*ENDWHEN
The average values will be written to 4 months of the next year!
To copy actual months as is to the next year just add the following code at the end:
*WHEN TIME
*FOR %TA%=%ACTPERS%
*IS %TA%
*REC(EXPRESSION=%VALUE%,TIME=TMVL(12,%TA%))
*NEXT
*ENDWHEN
Result:
*WHEN TIME
*IS 2016.01
*REC(EXPRESSION=%VALUE%,TIME= 2017.01 )
*IS 2016.02
*REC(EXPRESSION=%VALUE%,TIME= 2017.02 )
*IS 2016.03
*REC(EXPRESSION=%VALUE%,TIME= 2017.03 )
*IS 2016.04
*REC(EXPRESSION=%VALUE%,TIME= 2017.04 )
*IS 2016.05
*REC(EXPRESSION=%VALUE%,TIME= 2017.05 )
*IS 2016.06
*REC(EXPRESSION=%VALUE%,TIME= 2017.06 )
*IS 2016.07
*REC(EXPRESSION=%VALUE%,TIME= 2017.07 )
*IS 2016.08
*REC(EXPRESSION=%VALUE%,TIME= 2017.08 )
*ENDWHEN
P.S. Is it clear?
P.S. If you have not standard TIME member ID's - not 2016.08 but 08.2016 (2016.AUG) then you have to use TIMEID property in selects like:
*SELECT(%Y%,YEAR,TIME,ID=%TIME_SET%)
*SELECT(%TID%,TIMEID,TIME,ID=%TIME_SET%)
*SELECT(%MN%,MONTHNUM,TIME,ID=%TIME_SET%)
*SELECT(%ACTPERS%,ID,TIME,TIMEID<=%TID% AND YEAR=%Y% AND CALC=N)
*SELECT(%AVGPERS%,ID,TIME,TIMEID>%TID% AND YEAR=%Y% AND CALC=N)
... THE REST IS THE SAME!
Thank you very much for the Code Vadim,
I´ll try to incorporate this to the other I have, to marke the anwer as correct , because the other scritpt was:
Usere selects months to get the BUDGET: lets say user selects 01.2017, 02.2017..... 08.2017.
Those mohts are calculated based 01.2016, 02. 2016..... 08.2016.... so the time scope was:
*FOR %T%=%PERIODO_SET%
*XDIM_MEMBERSET PERIODO=TMVL(-12,%T%)
to scope year 2016. Can I change the scope during the script?
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.