Configure an mpr object – Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 218

Advertising
background image

FactoryTalk EnergyMetrix Software

218

Create an MPR Excel Report

Please contact Rockwell Automation technical support or visit the Rockwell Automation
Knowledgebase for information on using the Excel template in MPR reports.

Configure an MPR Object

The properties and methods of MPR objects permit a great deal of customizing and
formatting. Each object has a unique set of configurable properties. Refer to the MPR
object model for details of each. Below are a few examples of using script to configure
MPR objects.

Configuring a Grid Object

The following example creates a Grid object and adds two columns, changes the header
height and font size from their default values of 0.12 and 10 respectively, defines the
header text and width of each column, and formats the text alignment and number format
of the second column.

dim grid As New Grid

dim col As Col

...

With grid : .HeaderHeight = 0.25 : .FontSize = 12 : End With

col = grid.AddCol("Column 1") : col.Width = 1.5

col = grid.AddCol("Column 2") : col.Width = 3 : _

col.Alignment = TextAlignment.Right : col.OutputFormat =
"$##,##0.##"

Configuring a TrendChart Object

Configuring a TrendChart object is a two-step process. Attributes that apply to the trend
chart should be addressed after the object is created but before the object is populated with
data. Data series attributes such as its legend should be addressed after each data series has
been added during the data population process. The following example creates a trend
chart and configures its properties.

dim chart1 as TrendChart()

...

chart1 = New TrendChart()

With chart1

.XAxis.Title = "Week ending date"

.YAxis.Title = "Consumption"

.XAxis.Step = 7

.XAxis.Format = AxisFormat.Date

.XAxis.CustomFormat = "MMM dd"

.YAxis.CustomFormat = "#"

Note the use of the colon ‘:’ which allows multiple statements
on the same line, and the underscore ‘_’ character which
continues the present line onto the next line. The With … End
With statements simplify accessing the properties of the grid
object. The same effect would be accomplished by using this
code: grid.HeaderHeight = 0.25 : grid.FontSize = 12.

Advertising