GridSafeDocumentation/ReportTemplates/Tables/

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 NameUserProjectSubmitted TimeStart TimeCompleted Time
myjobfredinf_hcrc_cstr_emime29/12/08 17:2031/12/08 23:2701/01/09 00:00
myjobfredinf_hcrc_cstr_emime29/12/08 17:2031/12/08 23:2801/01/09 00:00
STDINprdatlas014prdatlas31/12/08 23:5831/12/08 23:5801/01/09 00:00
myjobfredinf_hcrc_cstr_emime29/12/08 17:2031/12/08 23:2701/01/09 00:00
myjobfredinf_hcrc_cstr_emime29/12/08 17:2031/12/08 23:2701/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 NameUserProjectSubmitted TimeStart TimeCompleted Time
STDINprdatlas014prdatlas31/01/09 22:0031/01/09 23:5801/02/09 00:00
STDINprdatlas014prdatlas31/01/09 22:0031/01/09 23:5801/02/09 00:00
myjob-4fredecdf_baseline29/01/09 23:1631/01/09 23:5801/02/09 00:00
myjob-4fredecdf_baseline29/01/09 23:1631/01/09 23:5601/02/09 00:00
student-jobs0000111ecdf_baseline31/01/09 09:3331/01/09 11:2701/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:

ProjectTime
see_imp_costa_02103221
ngsadmin3022
inf_hcrc_cstr_ephones2048193
biology_ieb_belswort_011983717
inf_hcrc_cstr_emime28036599

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 NameTimePercent Use
wsjcam0-recmllr1-3197124.5%
wsjcam0-recmllr1-3190823.7%
STDIN1071.3%
wsjcam0-recmllr1-3199724.8%
wsjcam0-recmllr1-3206025.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 NameTime
wsjcam0-recmllr1-31971
wsjcam0-recmllr1-31908
STDIN107
wsjcam0-recmllr1-31997
wsjcam0-recmllr1-32060
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 NameUserTime
wsjcam0-recmllr1-3jyamagis2118
wsjcam0-recmllr1-3jyamagis2107
wsjcam0-recmllr1-3jyamagis2090
wsjcam0-recmllr1-3jyamagis2060
wsjcam0-recmllr1-3jyamagis1997
wsjcam0-recmllr1-3jyamagis1971
wsjcam0-recmllr1-3jyamagis1908
STDINprdatlas014110
STDINprdatlas014109
STDINprdatlas014107

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:

ProjectJanuaryFebruaryMarch
see_imp_costa_02103221
ngsadmin302294974195
inf_hcrc_cstr_ephones2048193258403718432107
biology_ieb_belswort_011983717137086328093
inf_hcrc_cstr_emime28036599924231515060853

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.

 

Grid-SAFE was funded by JISC and is maintained, developed, and managed by EPCC at the University of Edinburgh