Closed lie112 closed 5 years ago
This seems to be working ok for me. Here is my setup:
Manager:
public IModel[] Arr
{
get
{
return Apsim.ChildrenRecursively(Apsim.Parent(this, typeof(Simulation))).ToArray();
}
}
Report:
[Manager].Script.Arr[2].Name
Output:
Summary (name of the second model).
The array-indices in the report are 1-indexed (!), which is something to watch out for. Could you upload your .apsimx/.met files?
What if Arr is a List
Yep, that also seems to work for me. Is this not working for you?
Thanks. I had missed making the List a property and then there was a wayward report with an erroneous line causing problems. Adam
I am trying to report a property of a model item in a list in the Report. It doesn't seem that the variable string supports Model.Item[index].PropertyName I also tried creating a method Model.GetValue(int index) in the parent holding the list, but this function is not supported by the code getting the values either. Does anyone have a work around for this? Rather than use lists of models provided in the UI, I create a List in the background so that any code changes to these models does not influence the user setup for the next run. Now I need to report properties of some items in the list.