Tables
As with Charts a set of Usage Records can also be represented as a table. To incorporate charts into a report the tab namespace is defined in the Report.
<rep:Report xmlns:rep="http://safe.epcc.ed.ac.uk/report" xmlns:par="http://safe.epcc.ed.ac.uk/parameter" xmlns:per="http://safe.epcc.ed.ac.uk/period" xmlns:fil="http://safe.epcc.ed.ac.uk/filter" xmlns:tab="http://safe.epcc.ed.ac.uk/table">
A simple Table might look like this:
<tab:Table> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>User</tab:Name> <tab:Property>Person</tab:Property> </tab:Column> <tab:Column> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Column> <tab:Column> <tab:Name>Submitted Time</tab:Name> <tab:Property>SubmittedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Start Time</tab:Name> <tab:Property>StartedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Completed Time</tab:Name> <tab:Property>CompletedTimestamp</tab:Property> </tab:Column> </tab:Table>
This table prints a row containing the Job Name, User, Project, Submitted Time, Start Time and Completed Time for each record that is selected. Looking more closely at the first column to be printed, the column name is Job Name, and the property to be output is JobName. This table would be:
Job Name | User | Project | Submitted Time | Start Time | Completed Time |
---|---|---|---|---|---|
myjob | fred | inf_hcrc_cstr_emime | 29/12/08 17:20 | 31/12/08 23:27 | 01/01/09 00:00 |
myjob | fred | inf_hcrc_cstr_emime | 29/12/08 17:20 | 31/12/08 23:28 | 01/01/09 00:00 |
STDIN | prdatlas014 | prdatlas | 31/12/08 23:58 | 31/12/08 23:58 | 01/01/09 00:00 |
myjob | fred | inf_hcrc_cstr_emime | 29/12/08 17:20 | 31/12/08 23:27 | 01/01/09 00:00 |
myjob | fred | inf_hcrc_cstr_emime | 29/12/08 17:20 | 31/12/08 23:27 | 01/01/09 00:01 |
Periods
In the table above the default time period is used, which is from the start to the end of the current month. You can explicitly set the period by adding a period to you chart definition. For example:
<tab:Table> <per:Period> <per:StartTime>01-02-2009</per:StartTime> <per:EndTime>01-03-2009</per:EndTime> </per:Period> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>User</tab:Name> <tab:Property>Person</tab:Property> </tab:Column> <tab:Column> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Column> <tab:Column> <tab:Name>Submitted Time</tab:Name> <tab:Property>SubmittedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Start Time</tab:Name> <tab:Property>StartedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Completed Time</tab:Name> <tab:Property>CompletedTimestamp</tab:Property> </tab:Column> </tab:Table>
This table would be:
Job Name | User | Project | Submitted Time | Start Time | Completed Time |
---|---|---|---|---|---|
STDIN | prdatlas014 | prdatlas | 31/01/09 22:00 | 31/01/09 23:58 | 01/02/09 00:00 |
STDIN | prdatlas014 | prdatlas | 31/01/09 22:00 | 31/01/09 23:58 | 01/02/09 00:00 |
myjob-4 | fred | ecdf_baseline | 29/01/09 23:16 | 31/01/09 23:58 | 01/02/09 00:00 |
myjob-4 | fred | ecdf_baseline | 29/01/09 23:16 | 31/01/09 23:56 | 01/02/09 00:00 |
student-job | s0000111 | ecdf_baseline | 31/01/09 09:33 | 31/01/09 11:27 | 01/02/09 00:00 |
In fact the period does not have to be defined within the table. In the example below the period used for the table will be from 01-01-2009 to 01-01-2010 as defined for the whole report.
<rep:Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rep="http://safe.epcc.ed.ac.uk/report" xmlns:par="http://safe.epcc.ed.ac.uk/parameter" xmlns:per="http://safe.epcc.ed.ac.uk/period" xmlns:fil="http://safe.epcc.ed.ac.uk/filter" xmlns:tab="http://safe.epcc.ed.ac.uk/table"> <per:Period> <per:StartTime>01-01-2009</per:StartTime> <per:EndTime>01-01-2010</per:EndTime> </per:Period> <tab:Table> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>User</tab:Name> <tab:Property>Person</tab:Property> </tab:Column> </tab:Table> </rep:Report>
The table will pick up the nearest period. In the example below there are two periods defined. The period used in the chart will the one from 01-02-2009 to 01-03-2009.
<rep:Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rep="http://safe.epcc.ed.ac.uk/report" xmlns:par="http://safe.epcc.ed.ac.uk/parameter" xmlns:per="http://safe.epcc.ed.ac.uk/period" xmlns:fil="http://safe.epcc.ed.ac.uk/filter" xmlns:tab="http://safe.epcc.ed.ac.uk/table"> <per:Period> <per:StartTime>01-01-2009</per:StartTime> <per:EndTime>01-01-2010</per:EndTime> </per:Period> <tab:Table> <per:Period> <per:StartTime>01-02-2009</per:StartTime> <per:EndTime>01-03-2009</per:EndTime> </per:Period> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>User</tab:Name> <tab:Property>Person</tab:Property> </tab:Column> </tab:Table> </rep:Report>
Filters
The tables above show the job details over the whole data set. A filter could be defined to narrow the selection of usage records, say down to only one project, ecdf_baseline for example. You may wish to group by User. This plot would look like:
<tab:Table> <fil:Filter> <fil:EQ> <fil:Property>Project</fil:Property> <fil:Value>ecdf_baseline</fil:Value> </fil:EQ> </sel:Filter> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>User</tab:Name> <tab:Property>Person</tab:Property> </tab:Column> <tab:Column> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Column> <tab:Column> <tab:Name>Submitted Time</tab:Name> <tab:Property>SubmittedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Start Time</tab:Name> <tab:Property>StartedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Completed Time</tab:Name> <tab:Property>CompletedTimestamp</tab:Property> </tab:Column> </tab:Table>
As with Periods Filters do not have to be defined within the table. All of the Filters defined within the scope of the table will be combined. So in the case of this table:
<rep:Report xmlns:rep="http://safe.epcc.ed.ac.uk/report" xmlns:par="http://safe.epcc.ed.ac.uk/parameter" xmlns:per="http://safe.epcc.ed.ac.uk/period" xmlns:fil="http://safe.epcc.ed.ac.uk/filter" xmlns:plo="http://safe.epcc.ed.ac.uk/plot"> <sel:Filter> <sel:Match> <sel:Property>Project</sel:Property> <sel:Value>ecdfbaseline</sel:Value> <sel:Match> </sel:Filter> <tab:Table> <fil:Filter> <fil:EQ> <fil:Property>User</fil:Property> <fil:Value>paddymurphy</fil:Value> <fil:Match> </fil:Filter> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>User</tab:Name> <tab:Property>Person</tab:Property> </tab:Column> <tab:Column> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Column> <tab:Column> <tab:Name>Submitted Time</tab:Name> <tab:Property>SubmittedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Start Time</tab:Name> <tab:Property>StartedTimestamp</tab:Property> </tab:Column> <tab:Column> <tab:Name>Completed Time</tab:Name> <tab:Property>CompletedTimestamp</tab:Property> </tab:Column> </tab:Table> </rep:Report>
The selection used will be only those of the User paddymurphy for the Project ecdf_baseline.
Summary Tables
So far the tables have been outputting one row per UsageRecords selected, however you can use SummaryTables to group rows together and perform operations on them. For example, to group all the selected records by project and output a sum of the Wall for all the records a index of type Project is defined and a SumColumn of Wall is included.
<tab:SummaryTable> <tab:Index> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Index> <tab:SumColumn> <tab:Name>Time</tab:Name> <tab:Property>Wall</tab:Property> </tab:SumColumn> </tab:SummaryTable>
The table above would look like:
Project | Time |
---|---|
see_imp_costa_02 | 103221 |
ngsadmin | 3022 |
inf_hcrc_cstr_ephones | 2048193 |
biology_ieb_belswort_01 | 1983717 |
inf_hcrc_cstr_emime | 28036599 |
It is possible to specify multiple Index columns, in which case a new row will be generated for each unique combination of index values.
PercentColumn
It is possible to have percentage columns. The example below get the PercentColumn for the Column Time, and the name of the column is set to Percent Use.
<tab:Table> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>Time</tab:Name> <tab:Property>Wall</tab:Property> </tab:Column> <tab:PercentColumn> <tab:Name>Percent Use</tab:Name> <tab:Column>Time</tab:Column> </tab:PercentColumn> </tab:Table>
The table above would look like:
Job Name | Time | Percent Use |
---|---|---|
wsjcam0-recmllr1-3 | 1971 | 24.5% |
wsjcam0-recmllr1-3 | 1908 | 23.7% |
STDIN | 107 | 1.3% |
wsjcam0-recmllr1-3 | 1997 | 24.8% |
wsjcam0-recmllr1-3 | 2060 | 25.6% |
TotalColumn
<tab:Table> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>Time</tab:Name> <tab:Property>Wall</tab:Property> </tab:Column> <tab:TotalColumn> <tab:Name>Total</tab:Name> <tab:Column>Time</tab:Column> </tab:TotalColumn> </tab:Table>
The table above would look like:
Job Name | Time |
---|---|
wsjcam0-recmllr1-3 | 1971 |
wsjcam0-recmllr1-3 | 1908 |
STDIN | 107 |
wsjcam0-recmllr1-3 | 1997 |
wsjcam0-recmllr1-3 | 2060 |
8043 |
MaxRows
The number of records select can be limited by using the MaxRows.
<tab:Table> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:MaxRows>2</tab:MaxRows> </tab:Table>
The table above would look like:
Job Name |
---|
wsjcam0-recmllr1-3 |
wsjcam0-recmllr1-3 |
SortBy
The table can be sorted by using the SortBy tag. The example below sort the rows first by User and then by Time, in reverse.
<tab:Table> <tab:Column> <tab:Name>Job Name</tab:Name> <tab:Property>JobName</tab:Property> </tab:Column> <tab:Column> <tab:Name>User</tab:Name> <tab:Property>Person</tab:Property> </tab:Column> <tab:Column> <tab:Name>Time</tab:Name> <tab:Property>Wall</tab:Property> </tab:Column> <tab:SortBy> <tab:Columns>User,Time</tab:Columns> <tab:Reverse>true</tab:Reverse> </tab:SortBy> </tab:Table>
The table above would look like:
Job Name | User | Time |
---|---|---|
wsjcam0-recmllr1-3 | jyamagis | 2118 |
wsjcam0-recmllr1-3 | jyamagis | 2107 |
wsjcam0-recmllr1-3 | jyamagis | 2090 |
wsjcam0-recmllr1-3 | jyamagis | 2060 |
wsjcam0-recmllr1-3 | jyamagis | 1997 |
wsjcam0-recmllr1-3 | jyamagis | 1971 |
wsjcam0-recmllr1-3 | jyamagis | 1908 |
STDIN | prdatlas014 | 110 |
STDIN | prdatlas014 | 109 |
STDIN | prdatlas014 | 107 |
Formatting
The order in which the columns and rows appear is that in which they are specified. Generally this is sufficient, but there are circumstances in which this might be limiting. For example to output a PercentColumn before the Column it's a percent of. To do this there are special formatting tags which can be used.
They are defined as follows:
- SetColumnAt - Put this column at position 4.
<tab:SetColumnAt> <tab:Column>Percent Residency</tab:Column> <tab:At>4</tab:At> </tab:SetColumnAt>
- SetColumnAfter - Put this column after the column called Percent Time.
<tab:SetColumnAfter> <tab:Column>Percent Residency</tab:Column> <tab:After>Percent Time</tab:After> </tab:SetColumnAfter>
- SetColumnLast - Make this column the last one.
<tab:SetColumnLast> <tab:Column>Job ID</tab:Column> </tab:SetColumnLast>
- SetRowAt - Put this row at position 5.
<tab:SetRowAt> <tab:Row>SubTotal Time</tab:Row> <tab:At>5</tab:At> </tab:SetRowAt>
- SetRowAfter - Put this row after the row called SubTotal Time.
<tab:SetRowAfter> <tab:Row>SubTotal Residency</tab:Row> <tab:After>SubTotal Time</tab:After> </tab:SetRowAfter>
- SetRowLast - Make this row the last one.
<tab:SetRowLast> <tab:Row>Total</tab:Row> </tab:SetRowLast>
In most cases a default format for columns will be generated based on the type of the property expression being generated. In most cases these default formats will be adequate but it is also possible to fine-tune the formatting.
- NumberFormat - control the formatting of a numeric column.
<tab:NumberFormat> <tab:Column>Numbers</tab:Column> <tab:MaximumIntegerDigits>3</tab:MaximumIntegerDigits> <tab:MinimumIntegerDigits>3</tab:MinimumIntegerDigits> <tab:MaximumFractionDigits>3</tab:MaximumFractionDigits> <tab:MinimumFractionDigits>3</tab:MinimumFractionDigits> </tab:NumberFormat>
- PercentFormat - format a numeric column as a percentage.
<tab:PercentFormat> <tab:Column>Numbers</tab:Column> <tab:MaximumFractionDigits>3</tab:MaximumFractionDigits> <tab:MinimumFractionDigits>3</tab:MinimumFractionDigits> </tab:PercentFormat>
- DateFormat - format a date column. Formats are defined as the Java DateFormat class.
<tab:DateFormat> <tab:Column>Numbers</tab:Column> <tab:Format>YYYY-MM-dd</tab:Format> </tab:DateFormat>
- Format - specify a custom formatter written in java.
<tab:Format> <tab:Column>Things</tab:Column> <tab:Type>ThingFormatter</tab:Type> </tab:Format>
New columns can be generated as combinations of existing columns
- CombineColumn - combine two columns numerically.
<tab:CombineColumn> <tab:Dest>Difference</tab:Dest> <tab:Arg1>Expected</tab:Arg1> <tab:Arg2>Actual</tab:Arg2> <tab:Operator>SUB</tab:Operator> </tab:CombineColumn>
- Remove - Remove a column (for example if the column is needed for a combine operation but should not be displayed.)
<tab:Remove> <tab:Column>Temp</tab:Column> </tab:Remove>
All the processing and formatting tags for Table also apply to SummaryTable with the exception of MaxRows.
Compound Tables
The Filters and Periods are applied at the Table level, hence you can not have a table where one column shows the Wall for January and the next for February and so on. This type of functionality can be achieved through CompoundTables. A CompoundTable is simply the aggregation of two or more tables of the same type. The example below shows a CompoundTable of three SummaryTables.
<tab:CompoundTable> <tab:SummaryTable> <per:Period> <per:StartTime>01-01-2009</per:StartTime> <per:EndTime>01-02-2009</per:EndTime> </per:Period> <tab:Index> <tab:Property>Project</tab:Property> </tab:Index> <tab:Column> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Column> <tab:SumColumn> <tab:Name>January</tab:Name> <tab:Property>Wall</tab:Property> </tab:SumColumn> </tab:SummaryTable> <tab:SummaryTable> <per:Period> <per:StartTime>01-02-2009</per:StartTime> <per:EndTime>01-03-2009</per:EndTime> </per:Period> <tab:Index> <tab:Property>Project</tab:Property> </tab:Index> <tab:Column> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Column> <tab:SumColumn> <tab:Name>February</tab:Name> <tab:Property>Wall</tab:Property> </tab:SumColumn> </tab:SummaryTable> <tab:SummaryTable> <per:Period> <per:StartTime>01-03-2009</per:StartTime> <per:EndTime>01-04-2009</per:EndTime> </per:Period> <tab:Index> <tab:Property>Project</tab:Property> </tab:Index> <tab:Column> <tab:Name>Project</tab:Name> <tab:Property>Project</tab:Property> </tab:Column> <tab:SumColumn> <tab:Name>March</tab:Name> <tab:Property>Wall</tab:Property> </tab:SumColumn> </tab:SummaryTable> </tab:CompoundTable>
The table above would look like:
Project | January | February | March |
---|---|---|---|
see_imp_costa_02 | 103221 | ||
ngsadmin | 3022 | 9497 | 4195 |
inf_hcrc_cstr_ephones | 2048193 | 2584037 | 18432107 |
biology_ieb_belswort_01 | 1983717 | 1370863 | 28093 |
inf_hcrc_cstr_emime | 28036599 | 9242315 | 15060853 |
It is possible to use the parameter For and Repeat elements to generate a set of tables that are then combined into a single compound table.