0

I have a population of agents as employees. They have a salary which has a formula to be calculated, so I defined it as dynamic variable, "salary". I want to know the average of the salaries, so I went to the statistics and defined:

Name: AvgSalary
Type: Average
Expression : item.Salary

The question is that I may need to assign this number to a variable so that it can be used in other formulas in other stages of my evaluation. How is that possible?

Many thanks in advance,

user710
  • 161
  • 2
  • 12

1 Answers1

1

Your statistic object AvgSalary is already an object you can access. You defined it in the properties of the agent population so you can access it by baccling myAgentPopulation.AvgSalary() and it will always return the current value.

Hope this helps

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • I created a dynamic variable "AvgSalary" , and I wrote this in its property so that the values return and I can use them somewhere else: Employees.AvgSalary(), but it has an error saying that "The method AvgSalary() is undefined for the type Employees. " – user710 Jan 17 '17 at 14:54
  • 1
    Rana, what is the Employees in your model? Agent type, population of agents, ...? Java is a case-sensitive programming language. Therefore "Employees" and "employees" are considered as different names. In order to avoid typo errors, I recommend you to type any Java code using code completion master (key sequence – Ctrl+Space).You can access the statistics collected over agent population like: .AvgSalary() – Tatiana Gomzina Jan 25 '17 at 12:53