Setdaterange function – Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 134

Advertising
background image

FactoryTalk EnergyMetrix Software

134

SetDateRange Function

The SetDateRange function changes the calculation start and end dates with respect to the
Report End Date. It operates only on the current line item. SetDateRange returns no value.
This function can be used to generate reports that compare current usage with historical
usage or to accommodate billing charges that apply for a certain number of hours in each
billing period.

Usage

SetDateRange(DateOffset.enumValue)

[valid enumValues for DateOffset in this usage are PreviousMonth, PreviousYear,
YearToDate. CurrentYear has no effect.]

SetDateRange(DateOffset.enumValue, Month.enumValue)

[valid enumValues for DateOffset in this usage are PreviousYear, CurrentYear.
PreviousMonth has no effect.]

SetDateRange(DateOffset.enumValue, hours)

[allowable enumValues for DateOffset in this usage are Before, After]

Comments

The hours argument is an integer. Assigning a value larger than the number of hours in the
billing month will return invalid results.

Do not call this function more than once in the same line item.

This function modifies the reporting span for all subsequent function calls in the current
line item only. All other line items in the rate schedule utilize the original report start and
end dates.

SetDateRange(DateOffset.Before, hours) will set the line item end date to (report start
date + hours), with an upper limit of the original report end date.

Calling SetDateRange(DateOffset.After, hours) will set the line item start date to (initial
report start date + hours), with an upper limit of the original report end date.

Examples

Example 1 uses this function to access data from the previous year for the same billing
period.

SetDateRange(DateOffset.PreviousYear)

'Perform calculations...

Example 2 uses this function to access data for a specific month in the current year.

SetDateRange(DateOffset.CurrentYear,Month.January)

'Perform calculations...

Example 3 uses this function to address a special charge that applies for the first 250
hours of the billing month.

SetDateRange(DateOffset.Before,250)

'Calculate value and multiply by rate...

Advertising