Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual
Page 283

9
•
ReportsPlus
283
End With
objCol = objGrid.AddCol("Ending Date")
With objCol
.Width = 1.2
End With
objFM = Report.FiscalMonths(Report.FiscalMonths.Count -
1) 'selects most recent fiscal month in report period
Do While Not objFM Is Nothing
objRow = objGrid.AddRow()
objRow(0) = objFM.FiscalYearNumber
objRow(1) =
Format(objFM.StartDate.AddDays(14),"MMMM")
objRow(2) =
objFM.EndDate.Subtract(objFM.StartDate).Days / 7
objRow(3) = Format(objFM.EndDate, "d")
objFM = objFM.AddFiscalMonths(-1)
Loop
Report.Add(objGrid, 0, Functions.CursorPos)
End Sub
RTF sample
This sample script provides an example of using RTF codes to construct specialized
dashboard indicators by using text graphics and colors. The script also demonstrates the
use of subroutines with parameters being passed to them by the calling routine.
Sub Main()
Report.Orientation = PageOrientation.Landscape
MakeHorizBarChart1("Natural Gas", 123456, 234567,
345678, 7, 10, 3.5, 2, 0.15, Functions.CursorPos)
MakeHorizBarChart1("Electric", 234567, 345678, 456789,
5, 11, 3.5, 2, 3.65, Functions.CursorPos)
MakeHorizBarChart1("Water", 345678, 456789, 567890, 4,
4, 3.5, 2, 7.15, Functions.CursorPos)
End Sub
Sub MakeHorizBarChart1(ByVal strUtility As String, _
ByVal dblCost1 As Double, _
ByVal dblCost2 As Double, _
ByVal dblCost3 As Double, _
ByVal intDays1 As Integer, _
ByVal intDays2 As Integer, _
ByVal dblWidth As Double, _
ByVal dblHeight As Double, _
ByVal dblLeft As Double, _
ByVal dblTop As Double)
' local variable declarations
Dim dblTotalAccrual As Double = dblCost2 + dblCost3
'special case
Dim intDaysAll As Integer = Report.Days.Count
If intDaysAll > 35 Then intDaysAll = 35
Dim objRtb1 As New RichTextBox()
Dim objRtb2 As New RichTextBox()