Hi, I am trying to achieve the following:
Copy values of “Plan” item to “Revised Plan” item (model is attached). The script should take given particular year and month and apply to this year and this months plus future months. It is easier to do it for particular matrix, but the idea is having script which goes through all matrices and if there is an item “Plan” copy it values to “Revised Plan” for a given year and months onward. It should skip matrices where those items do not exist. Any advice is appreciated.
Thank you for sharing the a-script. It was informative. I have optimized a little bit a-script:
After extensive reading, learning and trying I have figured out how to write this script. If anyone interested in accessing items and categories across the whole model via script with dynamic input, please see attached model.
monthsineed = |Selector::MonthStart|.value + “..” + |Selector::MonthEnd|.value
itemineed = |Selector::Itemneeded|.value + “:”
itemdestination = |Selector::Itemwheretoput|.value + “:”
yearineed = |Selector::Yearneeded|.value + “:”
fg = model.matrices[it].getSelection(yearineed+itemineed+monthsineed)
gh = model.matrices[it].getSelection(yearineed+itemdestination+monthsineed)
gh.values = fg.values
This model is an example. Real models are bigger. Data source for Plan is manual entry.
In the attached model there are 5 matrices in total. Manually filling their cells would not take a long time … Another question: what is the data source for the ‘Plan’ Item for each of the three matrices sharing category A?
Hi SAU. I meant from May 2019 until the end of the year. There are many matrices and many model templates where this operations is required. Those are all assumptions which should be simply populated again. Manually it would take a long time. Exactly I would like to copy “Plan” item values from May 2019 to Dec 2019 and paste to “Revised Plan” item values May 2019 to Dec 2019 in all matrices with one script.
Hi, for May 2019 manually fill in the cells of all matrices instead of the script: what exactly do you want to get in the model?