Menu

Resource Report

Help
2010-11-22
2013-04-29
  • HeinerHerbst

    HeinerHerbst - 2010-11-22

    Is it possible to create a report about my resource usage?
    Can I run this over all currently running projects?

     
  • Flemming

    Flemming - 2010-11-29

    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.

    #start = #$today.getNextMonday().addDays(-7 + (#Start_week * 7)),
    #noOfDays = new Integer(#Number_of_weeks * 7 - 2),
    #monthFormat = new java.text.SimpleDateFormat('MMMM'),
    #output = new StringBuffer(),
    #output.append('{table:class=availability}\n'),
    #projects = new java.util.HashMap(),
    allProjects.{
        #project = #this,
        #projects.put(#project.label, #project)
    },
    #projectKeys = new java.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 = new StringBuffer(),
        #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 = new java.util.ArrayList(),
        #project.projectResources.{
            #resource = #this,
    
            #totalAvailability = 0,
            #resourceOutput = new StringBuffer(),
            #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
    
     
  • HeinerHerbst

    HeinerHerbst - 2010-12-10

    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?

     
  • Flemming

    Flemming - 2010-12-10

    When posting the script  "greater than" characters were changed to > If you change them back throughout the script it should work.

     
  • HeinerHerbst

    HeinerHerbst - 2010-12-12

    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!

     
  • Flemming

    Flemming - 2010-12-13

    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

     

Log in to post a comment.

MongoDB Logo MongoDB