Below as an example is an OGNL script which I created to get an overview over ressources and their project allocations. The output in my case is Confluence code but you can output anything you like.
#start=#$today.getNextMonday().addDays(-7+(#Start_week*7)),#noOfDays=newInteger(#Number_of_weeks*7-2),#monthFormat=newjava.text.SimpleDateFormat('MMMM'),#output=newStringBuffer(),#output.append('{table:class=availability}\n'),#projects=newjava.util.HashMap(),allProjects.{#project=#this,#projects.put(#project.label,#project)},#projectKeys=newjava.util.ArrayList(),#projectKeys.addAll(#projects.keySet()),@java.util.Collections@sort(#projectKeys),"-- Process all projects in the portfolio --",#projectKeys.{#key=#this,#project=#projects.get(#key),#projectOutput=newStringBuffer(),#totalProjectAvailability=0,#projectOutput.append('{tr}{td:colspan='+#noOfDays+'}h3.'+#project.label+'{td}{tr}\n'),"-- Output the table headers --",#prevMonth='',#monthDays=0,#projectOutput.append('{tr}{th}{th}'),#noOfDays.{#no=#this,#day=#start.addDays(#no),#month=#day.toString(#monthFormat),#projectOutput.append((#monthDays==0||#month==#prevMonth)?'':'{th:colspan='+#monthDays+'}'+#prevMonth+'{th}'),#monthDays=(#monthDays==0||#month==#prevMonth)?#monthDays+1:1,#prevMonth=#month},#projectOutput.append('{th:colspan='+#monthDays+'}'+#prevMonth+'{th}'),#projectOutput.append('{tr}\n'),#projectOutput.append('{tr}{th}Mitarbeiter{th}'),#noOfDays.{#no=#this,#day=#start.addDays(#no),#projectOutput.append('{th}'+#day.dayOfTheMonthAsInt+'{th}')},#projectOutput.append('{tr}\n'),#rows=newjava.util.ArrayList(),#project.projectResources.{#resource=#this,#totalAvailability=0,#resourceOutput=newStringBuffer(),#label=#resource.person.label,#resourceOutput.append('{tr}{td}'+#label+'{td}'),#noOfDays.{#no=#this,#day=#start.addDays(#no),#percentage=#resource.getPercentageAvailability(#day),#availability=#resource.person.getAvailability(#day),#availability=#percentage>0?(#percentage/100)*#availability:0,#totalAvailability=#totalAvailability+#availability,#utilization=(#availability>=1?'full':(#availability>0?'part':'away')),#resourceOutput.append('{td:class='+#utilization+'}{td}')},#resourceOutput.append('{tr}\n'),#rows.add(#totalAvailability>0?#resourceOutput.toString():''),#totalProjectAvailability=#totalProjectAvailability+#totalAvailability},@java.util.Collections@sort(#rows),#rows.{#row=#this,#projectOutput.append(#row)},#output.append(#totalProjectAvailability>0?#projectOutput:'')},#output.append('{table}\n'),#output
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I really just posted the script to show you an example of how one can output information about resource usage. The output is not going to be of any value to you as is unless you use Confluence.
To actually generate some output there are a few more things you need to do:
- Make the script applicable to "Portfolio"
- Add the following parameters to your action on the Details tab:
Number of weeks, defaultValue(5), INTEGER
Start week, defaultValue(-1), INTEGER
- Make the action an "Export action" by ticking the box
- Make sure you have at least one project with at least one task and a person assigned to it
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible to create a report about my resource usage?
Can I run this over all currently running projects?
The answer to both questions is yes.
Below as an example is an OGNL script which I created to get an overview over ressources and their project allocations. The output in my case is Confluence code but you can output anything you like.
When creating a new action and pasting your script into, I get the following error:
"Unable to save, OGNL Error: Malformd OGNL expression:…"
What is wrong?
When posting the script "greater than" characters were changed to > If you change them back throughout the script it should work.
Sorry, I'm new to that, but I get a new exception when running the report:
Exceptions occured performing test
Method "new" failed for object Integer
What's wrong here?
Thanks!
I really just posted the script to show you an example of how one can output information about resource usage. The output is not going to be of any value to you as is unless you use Confluence.
To actually generate some output there are a few more things you need to do:
- Make the script applicable to "Portfolio"
- Add the following parameters to your action on the Details tab:
Number of weeks, defaultValue(5), INTEGER
Start week, defaultValue(-1), INTEGER
- Make the action an "Export action" by ticking the box
- Make sure you have at least one project with at least one task and a person assigned to it