insert a report-column macro underneath the content-reporter block
name this column Project Name
insert a report-info block inside this report-column
edit the report-info block
name the Keycontent:title
check Link To Item
Project Status
insert a report-column macro
name this column Project Status
insert a report-info block inside this report-column
Eedit the report-info block
name the Key data:Project Status
Days left: if-else statements and parameter injection
Create a simple if-elsestatement that will display the days left for ongoing projects or display a completed message if the project is over.
With report-eval, we can do calculations on predefined variables, suppliers or Scaffolding data blocks.
In the report-eval block, we will perform the calculation of Days Left using parameter injection
set the parameters for report-eval as
Name - Days Left
Default Value - 0
Format - #,00
check Hidden
For the report-eval calculation formula
type the following
(%
data:Project End Date > date:milliseconds
% - %
global:current date > date:milliseconds
%)/1000/60/60/24
What does this mean?
In the first part
%data:Project End Date calls a Scaffolding Data block that contains the end date of the project
a keychain is then used to convert this date object to milliseconds
The second part
%global:current date calls the current date via the Global supplier
a keychain is then also used to convert the date object into milliseconds
Together, the above formula
converts both end date and current date into milliseconds
gets the difference (in milliseconds)
converts back to days with division
The report-eval variable can then be accessed via the Variable supplier. The key is the name of the report-eval block - variable:Days Left.
Now create a report-block macro for the if-else statement.
In the report-block macro
insert a local-reporter block
set the keychain to @self
Next
create a number-filter macro
set the keychain to variable:Days Left
set Above Value to 0
insert a report-body block
set injected to true
Inside the report-body block
type:
%
variable:Days Left > number:#
% day(s)
Now create the 'else' statement by
inserting another number-filter macro
set the keychain to variable:Days Left
set Below Value to 0
insert a report-body block
type: This project has ended
This creates a report-block shown below.
Haven't I done this in the subproject template?
report-eval creates a temporary variable in the given page
the variable is only accessible from that page and cannot be fetched and displayed in other pages
Using the flexibility of report-eval's calculation abilities, we created a temporary variable in the subproject page, and now we need to create another temporary variabe in the current report to get Days Left, using the same formula and report structure.
Number of Milestones
insert a report-column under the previous Days Left column
name this column Number of milestones
insert a report-info block inside this report-column
edit the report-info block
name the Key data:Project Milestones > collection:size
Budget Total
This column will return the sum of all milestone budgets from a particular subproject. The sum of all subproject's budget can also be calculated using report-column.
insert a report-column
name this column Budget total
edit the report-column settings
Summary Type to sum
Summary Value to data:Budget Total
Summary Format to $#,##0.00
insert a report-info block inside the report-column
name the Keydata:Budget Total
set the Format to $##,##0.00
Expenditure Total
This column returns the sum of all milestone expenditures from a particular subproject. The sum of all subprojects expenditures can also be calculated using report-column.
insert a report-column
name this column Expenditure total
edit the report-column settings
Summary Type to sum
Summary Value to data:Expenditure Total
Summary Format to $#,##0.00
insert a report-info block inside the report-column
name the Key data:Expenditure Total
set the Format to $##,##0.00
Budget Deficit
This column returns the sum of all budget deficits from a particular subproject. It is calculated using the difference of actual expenditure and allocated budget for each subproject.
insert a report-column
name this column Budget deficit
edit the report-column settings
Summary Type to sum
Summary Value to variable:Budget Deficit
Summary Format to $#,##0.00
insert a report-eval inside the report-column
name it Budget Deficit
In the report-eval
type %data:Budget Total% - %data:Expenditure Total%
Budget Deficit %
This column returns the budget deficit in percentage. It is calculated using the Budget Deficit variable created in the previous section and dividing that amount by Budget Total.
insert a report-column
name this column Budget deficit percentage
insert a report-eval block inside report-column
name the report-eval block Percentage Deficit
edit the report-eval block
set Default Value to 0
set Format to #%.
In the report-eval
type %variable:Budget Deficit% / %data:Budget Total%