Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual
Page 282

FactoryTalk EnergyMetrix Software
282
Cost by Group Pie Chart
This sample MPR script generates a report with a pie chart showing cost by group. Each
group consists of multiple utilities and each utility has its own rate schedule. The utility costs
for each group are prorated based on the monthly site rate schedule for the utility. Rate
schedules must be set up to support cost allocation. See
Use the MPR for Cost Allocation
.
The script uses the Groups collection and the Group, PieChart and Report objects. It is
designed for Select By Groups.
Sub Main()
Dim group As Group
Dim cost As Double
Dim pieChart As New PieChart
For Each group In Report.Groups
cost = group.CostAllocate("Electric Billing Report", "Electric
Cost Allocation")
cost += group.CostAllocate("Gas Billing Report", "Gas Cost
Allocation")
cost += group.CostAllocate("Water Billing Report", "Water Cost
Allocation")
pieChart.AddData(group.Name, cost)
Next group
Report.Add(pieChart, 0, 0, 7.5, 7.5)
End Sub
Fiscal Calendar Listing
This sample report generates a listing of the configured fiscal calendars, starting with the
most recent fiscal month in the selected report period. It uses a number of MPR objects
and methods, including a Grid object, the Report.FiscalMonths collection, and the
AddFiscalMonths method.
Sub Main()
'Create your script code here
Dim objGrid As New Grid()
Dim objCol As Col
Dim objRow As Row
Dim objFM As FiscalMonth
Dim intItem As Integer
objCol = objGrid.AddCol("FY")
With objCol
.Width = 0.6
End With
objCol = objGrid.AddCol("Month")
With objCol
.Width = 1.0
End With
objCol = objGrid.AddCol("Weeks")
With objCol
.Width = 0.6