on 2015 Nov 19 11:45 AM
Hi folks,
Please i want to do a logic script who calculate the final stock , I have the member Stock_ initial at the dimension Rubrique_stock and i have the member Ventes ,
the initial stock is the stock of the the last mounth of last year , and for Ventes it's depending of a mount of the current year ,
here is the script i did but it does not work .
*XDIM_FILTER ARTICLE_SOCIETE = [ARTICLE_SOCIETE].PROPERTIES("TYPE_ARTICLE") ="ZPFN"
*XDIM_MEMBERSET TYPE_VALEUR = QTE
*WHEN RUBRIQUE_STOCK
*IS Stock_initial
//*REC(EXPRESSION = [RUBRIQUE_STOCK].[Stock_initial] + ([RUBRIQUE_STOCK].[Entrées],[TEMPS].[2015.IMP]) - ([RUBRIQUE_STOCK].[Ventes],[TEMPS].[2015.IMP]) - ([RUBRIQUE_STOCK].[Sorties],[TEMPS].[2015.IMP]), RUBRIQUE_STOCK = Stock)
*REC(EXPRESSION = ([RUBRIQUE_STOCK].[Stock_initial],[TEMPS].[2014.12]) - [RUBRIQUE_STOCK].[Sorties], RUBRIQUE_STOCK = Stock)
*ENDWHEN
*COMMIT
You will find attached a screen of the input forms
please what do you suggest ?
Request clarification before answering.
Not clear!
Please provide something like:
RUBRIQUE_STOCK: Stock_initial
TEMPS: 2014.12
Minus
RUBRIQUE_STOCK: Sorties or Ventes???
TEMPS: 2015.IMP or ?? Not clear
Result:
RUBRIQUE_STOCK: Stock
TEMPS: 2015.02 Not clear??
Vadim
P.S. And it's a bad idea to provide code with commented lines - just lead to misunderstanding
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the stock _initial of last year , and i have Sorties not Ventes .
I have to calculate Ventes of every mounth at the current year
for exemple
Stock of article 1 for month 2015.01= Ventes (2015.01)- Stock initial ( 2014.12)
Stock of article 1 for month 2015.02= Ventes (2015.02)- Stock initial ( 2014.12)
Ok, then:
*XDIM_FILTER ARTICLE_SOCIETE = [ARTICLE_SOCIETE].PROPERTIES("TYPE_ARTICLE") ="ZPFN"
*XDIM_MEMBERSET TYPE_VALEUR = QTE
*XDIM_MEMBERSET RUBRIQUE_STOCK = Stock_initial,Ventes
*XDIM_MEMBERSET TEMPS = 2014.12,2015.01,2015.02,2015.03,2015.04,2015.05,2015.06,2015.07,2015.08,2015.09,2015.10,2015.11,2015.12
*WHEN TEMPS
*IS 2014.12
*WHEN RUBRIQUE_STOCK
*IS Stock_initial
*FOR %M%=01,02,03,04,05,06,07,08,09,10,11,12
*REC(EXPRESSION=-%VALUE%,RUBRIQUE_STOCK=Stock,TEMPS=2015.%M%)
*NEXT
*ENDWHEN
*ELSE //months of current year
*WHEN RUBRIQUE_STOCK
*IS Ventes
*REC(EXPRESSION=%VALUE%,RUBRIQUE_STOCK=Stock)
*ENDWHEN
*ENDWHEN
Vadim
The script in Default.lgf below will work if you enter number of Ventes values in the SINGLE YEAR and save!
It will not work on changes of Stock_initial.
//%TEMPS_SET% contain initial scope of sent data for TEMPS dimension - for the same year
*SELECT(%YS%,[YEAR],TEMPS,[ID]=%TEMPS_SET%) //%TEMPS_SET% = ex.: 2015.02,2015.04,2015.05
//%YS% will have years: 2015,2015,2015
*SELECT(%M1%,[ID],TEMPS,[YEAR]=%YS% AND MONTHNUM=1) //%M1% - will contain January of this year 2015.01
*WHEN ARTICLE_SOCIETE.TYPE_ARTICLE
*IS ZPFN
*WHEN TYPE_VALEUR
*IS QTE
*WHEN RUBRIQUE_STOCK
*IS Ventes
*REC(EXPRESSION=%VALUE%-([RUBRIQUE_STOCK].[Stock_initial],[TEMPS].[TMVL(-1,%M1%)]),RUBRIQUE_STOCK=Stock) //TMVL(-1,%M1%)=2014.12
*ENDWHEN
*ENDWHEN
*ENDWHEN
Please read also my document about default.lgf:
Vadim
The script can be adjusted to accept simultaneous multi year data entry in Ventes:
*SELECT(%YS%,[YEAR],TEMPS,[ID]=%TEMPS_SET%) //%TEMPS_SET% = ex.: 2015.02,2015.04,2016.05
//%YS% will have years: 2015,2015,2016
*SELECT(%M1S%,[ID],TEMPS,[YEAR]=%YS% AND MONTHNUM=1) //%M1S% - will contain January of two years 2015.01 an 2016.01
*FOR %M1%=%M1S% //Loop 2015.01,2016.01
*WHEN ARTICLE_SOCIETE.TYPE_ARTICLE
*IS ZPFN
*WHEN TYPE_VALEUR
*IS QTE
*WHEN RUBRIQUE_STOCK
*IS Ventes
*REC(EXPRESSION=%VALUE%-([RUBRIQUE_STOCK].[Stock_initial],[TEMPS].[TMVL(-1,%M1%)]),RUBRIQUE_STOCK=Stock) //TMVL(-1,%M1%)=2014.12
*ENDWHEN
*ENDWHEN
*ENDWHEN
*NEXT
But for changes in Stock_initial you will have to run DM package.
Vadim
| User | Count |
|---|---|
| 16 | |
| 11 | |
| 9 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 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.