Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Batch Management

Add new Report Code to Report

  • Last UpdatedJun 14, 2019
  • 2 minute read

Copy and add the new Report Functions code to the custom Report.

New Report Function Code

Public Function TimeZoneToUtc( ByVal strTimeZoneName As String, _

ByVal strDateTimeLocal As DateTime ) As DateTime

Dim res As DateTime

res = BatchTimeExtensions.BatchTimeFunctions.TimeZoneToUtc(strTimeZoneName, strDateTimeLocal)

Return res

End function

Public Function UtcToTimeZone( ByVal strTimeZoneName As String, _

ByVal strDateTimeUtc As DateTime ) As DateTime

Dim res As DateTime

res = BatchTimeExtensions.BatchTimeFunctions.UtcToTimeZone(strTimeZoneName, strDateTimeUtc)

Return res

End function

Public Function GetTimeZoneDateTime( ByVal strTimeZoneName As String, _

ByVal strDateTimeLocal As DateTime, _

ByVal strDateTimeUtc As DateTime ) As String

Dim res As String

Dim strDateTime = BatchTimeExtensions.BatchTimeFunctions.GetTimeZoneDateTime(strTimeZoneName, strDateTimeLocal, strDateTimeUtc)

res = String.Format("{0} {1}", FormatDateTime(strDateTime, 2), FormatDateTime(strDateTime, 3))

Return res

End function

Public Function GetTimeZoneOffset( ByVal strTimeZoneName As String, _

ByVal strDateTimeLocal As DateTime, _

ByVal strDateTimeUtc As DateTime ) As String

Dim resOffset As String

resOffset = BatchTimeExtensions.BatchTimeFunctions.GetTimeZoneOffset(strTimeZoneName, strDateTimeLocal, strDateTimeUtc)

Return resOffset

End function

Public Function GetReportDateRange(ByVal strTimeZoneId As String, _

ByVal strTimeZone As String, _

ByVal strStartDateTime As DateTime, _

ByVal strEndDateTime As DateTime ) As String

Dim res As String

res = " "

Dim startDateTime As DateTime

Dim endDateTime As DateTime

If (Trim(strTimeZoneId)="BSLT") Then

res = String.Format(" (BD.DateTime Between '{0}' AND '{1}') ", Format(strStartDateTime, "s"), Format(strEndDateTime, "s"))

ElseIf (Trim(strTimeZoneId)="UTC") Then

res = String.Format(" (BD.DateTimeUTC Between '{0}' AND '{1}') ", Format(strStartDateTime, "s"), Format(strEndDateTime, "s"))

Else

startDateTime = BatchTimeExtensions.BatchTimeFunctions.TimeZoneToUtc(strTimeZone, strStartDateTime)

endDateTime = BatchTimeExtensions.BatchTimeFunctions.TimeZoneToUtc(strTimeZone, strEndDateTime)

res = String.Format(" (BD.DateTimeUTC Between '{0}' AND '{1}') ", Format(strStartDateTime, "s"), Format(strEndDateTime, "s"))

End If

Return res

End function

Public Function GetReportDateColumn( ByVal strTimeZoneId As String, ByVal strColumnPrefix As String) As String

Dim res As String

res = ""

If (Trim(strTimeZoneId) = "BSLT") Then

res = strColumnPrefix & "DateTime"

Else

res = strColumnPrefix & "DateTimeUTC"

End If

Return res

End function

Public Function GetTimeZoneSuffix(ByVal strTimeZoneId As String) As String

Dim res As String

res = ""

If (Trim(strTimeZoneId)<>"BSLT") Then

res = " (" + Trim(strTimeZoneId) + ")"

End If

Return res

End function

Public Function GetServerTimeZoneSuffix() As String

Dim res As String

res = System.Text.RegularExpressions.Regex.Replace(IIF(System.TimeZone.CurrentTimeZone().IsDaylightSavingTime(now

()),System.TimeZone.CurrentTimeZone ().DaylightName,System.TimeZone.CurrentTimeZone().StandardName),"[^A-Z]","")

res = " (" + res + ")"

Return res

End function

Public Function GetFixedStringFormat( ByVal decimalValue As Double ) As String

Dim resFormatString as String

resFormatString = BatchTimeExtensions.BatchTimeFunctions.GetFixedStringFormat(decimalValue)

Return resFormatString

End Function

Note: This method is used to display Float values in 8 significant digit format in the Float fields of SSRS reports.

TitleResults for “How to create a CRG?”Also Available in