Skip to main content

Using User Defined Field In Omicron Control Center Document

Welcome to my tutorial page. In this tutorial, I will show you how to use UserDefined field in the OCC document. 

In the Report View of the Control Center, you can customize your overall report. Test modules may be embedded in the report, and run from it. One report can be used as a standard template to retest and compare one or more test objects. Example, by inserting basic field like page number, page count, page title and etc. UserDefined field is basically the same with the basic field but it can only use programmatically. Because if insert UserDefined field it will display nothing or empty. So, this is the tutorial all about, how to use these fields. 

Now download this file Omicron Control Center - UserDefined Field. This file was created in the previous tutorial series called Omicron Control Center Custom Dialog using Test Universe 4.20. If you can't open this file, your software might be outdated. You have to upgrade you Test Universe to version 4.20 or check the link below to create this file using your current Test Universe version.


Insert your logo or any picture by pasting inside the report view on the right side. Next, insert a new field by clicking the Field button at the Insert tab. Make sure the report view is selected to enable the Field insert button. Meaning the cursor should be inside the report view because the field will be inserted in the current cursor position.


When the Insert Field dialog open, scroll down at the available fields until you find the UserDefined 01 then select it and click OK button. This will display "n/a" because this field has no data. Insert another two UserDefined field, UserDefined 02 and UserDefined 03 then format them according to what you like. 


Once you complete the procedure above, the UserDefined should be arrange accordingly in the image. As you can see I also inserted a page brake meaning the information below that page brake will be printed in the next page.


Now, open the Script window by clicking the Script View button under the View tab then stop the script when its running. Find the SetRelayInformation procedure then insert the code below right after the line Dialog dlg.

Document.UserField(1) = UCase dlg.txtSubstationName
Document.UserField(2) = UCase dlg.txtCBName & " - " & dlg.txtCircuitName
Document.UserField(3) = UCase dlg.txtDeviceType

Once it done, click the Back to Report View button then run the script by clicking the SetRelayInformation button at Home tab. 


Change the relay data information then click OK button.


As you can see, the UserDefined fields has been updated. So, that's it. You can find the way where you gonna use this.

In the next tutorial, I will show you how to make a import filter for Omicron Control Center document. Check the video below to see what I mean.


See you next time.

Overall codes:
' ************************************************************
' This is module *Module1 .
' Automatically generated uses comments are placed here.
' Don't edit these lines.
' {BEGINUSES}
'#Uses "*Module1"
' {ENDUSES}
' ************************************************************

Public Const BASIC_INFO_PATH As String = "CUSTOM.RELAY_INFORMATION.BASIC"
Public Const SOURCE_PATH As String = "CUSTOM.RELAY_PARAMETERS.SOURCE"
Public Const TEST_CONTROLLER_PATH As String = "CUSTOM.TEST_CONTROLLER"
Public GlobalTO As XRio

Dim Source_Array() As String
Dim Source_Enum As AutoParameter


Sub SetRelayInformation()
On Error GoTo ErrorHandler
Set GlobalTO = Document.TestObjects(1).Specific

Begin Dialog UserDialog 480,273,"Relay Information Dialog Editor" ' %GRID:10,7,1,1
Text 10,14,140,14,"Substation Name:",.lblSubstationName
Text 10,42,140,14,"Substation Address:",.lblSubstationAddress
Text 10,70,140,14,"CB Name:",.lblCBName
Text 10,98,140,14,"Circuit Name:",.lblCircuitName
Text 10,126,140,14,"Device Type:",.lblDeviceType
Text 10,154,140,14,"Manufacturer:",.lblManufacturer
Text 10,182,140,14,"Serial Number:",.lblSerialNumber
Text 10,210,140,14,"Device Address:",.lblDeviceAddress
TextBox 160,14,300,21,.txtSubstationName
TextBox 160,42,300,21,.txtSubstationAddress
TextBox 160,70,300,21,.txtCBName
TextBox 160,98,300,21,.txtCircuitName
TextBox 160,126,300,21,.txtDeviceType
TextBox 160,154,300,21,.txtManufacturer
TextBox 160,182,300,21,.txtSerialNumber
TextBox 160,210,300,21,.txtDeviceAddress
OKButton 370,238,90,21,.btnOK
End Dialog
Dim dlg As UserDialog

dlg.txtSubstationName = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".SUBSTATION_NAME"))
dlg.txtSubstationAddress = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".SUBSTATION_ADDRESS"))
dlg.txtCBName = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".CB_NAME"))
dlg.txtCircuitName = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".CIRCUIT_NAME"))
dlg.txtDeviceType = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".DEVICE_TYPE"))
dlg.txtManufacturer = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".MANUFACTURER"))
dlg.txtSerialNumber = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".SERIAL_NUMBER"))
dlg.txtDeviceAddress = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".DEVICE_ADDRESS"))

Dialog dlg

Document.UserField(1) = UCase dlg.txtSubstationName
Document.UserField(2) = UCase dlg.txtCBName & " - " & dlg.txtCircuitName
Document.UserField(3) = UCase dlg.txtDeviceType

GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".SUBSTATION_NAME").ParameterString.SetDisplayValue dlg.txtSubstationName, ""
GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".SUBSTATION_ADDRESS").ParameterString.SetDisplayValue dlg.txtSubstationAddress, ""
GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".CB_NAME").ParameterString.SetDisplayValue dlg.txtCBName, ""
GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".CIRCUIT_NAME").ParameterString.SetDisplayValue dlg.txtCircuitName, ""
GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".DEVICE_TYPE").ParameterString.SetDisplayValue dlg.txtDeviceType, ""
GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".MANUFACTURER").ParameterString.SetDisplayValue dlg.txtManufacturer, ""
GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".SERIAL_NUMBER").ParameterString.SetDisplayValue dlg.txtSerialNumber, ""
GlobalTO.XRioDocument.GetParamFromIDs(BASIC_INFO_PATH & ".DEVICE_ADDRESS").ParameterString.SetDisplayValue dlg.txtDeviceAddress, ""

Document.TestObjects(1).CommitChanges

Set GlobalTO = Nothing

Exit Sub
ErrorHandler:
MsgBox(Err.Description, vbOkOnly+ vbCritical,"Error")
End Sub

Function GetDisplayString(Parameter As AutoParameter) As String
If Not Parameter Is Nothing Then
GetDisplayString = Parameter.DisplayString
Else
GetDisplayString = "-"
End If
End Function

Sub SetTheSourceController()
On Error GoTo ErrorHandler
Set GlobalTO = Document.TestObjects(1).Specific

Begin Dialog UserDialog 480,105,"Source Controller",.SourceControllerFunction ' %GRID:10,7,1,1
Text 10,14,140,14,"Source:",.lblSource
Text 10,42,140,14,"Selected Source:",.lblSelectedSource
DropListBox 160,14,300,21,Source_Array(),.dlbSource,2
TextBox 160,42,300,21,.txtSelectedSource
OKButton 370,70,90,21,.btnOK
CancelButton 270,70,90,21
End Dialog

Dim dlg As UserDialog

Dim DialogResult As Integer

DialogResult = Dialog (dlg)

Set GlobalTO = Nothing

Exit Sub
ErrorHandler:
MsgBox(Err.Description, vbOkOnly+ vbCritical,"Error")
End Sub

Function GetParameterEnumList(EnumParameter As AutoParameter) As String()
Dim Result As String
If Not EnumParameter Is Nothing Then
For i = 1 To EnumParameter.ParameterEnum.EnumValues.Count
Result = Result & EnumParameter.ParameterEnum.EnumValues.Item(i).DisplayName & ","
Next
Else
Result = "-,"
End If
GetParameterEnumList = Split(Result,",")
End Function

Function GetEnumIndex(EnumParameter As AutoParameter) As Integer
Dim Result As Integer
If Not EnumParameter Is Nothing Then
For i = 1 To EnumParameter.ParameterEnum.EnumValues.Count
If Trim(UCase(EnumParameter.ParameterEnum.EnumValues.Item(i).DisplayName)) Like Trim(UCase(EnumParameter.DisplayString)) Then
Result = i-1
End If
Next
Else
Result = 0
End If

GetEnumIndex=Result
End Function

Sub SetEnumValue(EnumParameter As AutoParameter, ValueIndex As Integer)
If Not EnumParameter Is Nothing Then
EnumParameter.ParameterEnum.SetDisplayValue EnumParameter.ParameterEnum.EnumValues.Item(ValueIndex+1).DisplayName, ""
End If
End Sub

Rem See DialogFunc help topic for more information.
Private Function SourceControllerFunction(DlgItem$, Action%, SuppValue?) As Boolean
Select Case Action%
Case 1 ' Dialog box initialization
Set Source_Enum = GlobalTO.XRioDocument.GetParamFromIDs(TEST_CONTROLLER_PATH & ".SOURCE")
Source_Array = GetParameterEnumList(Source_Enum)

DlgEnable "txtSelectedSource",False

DlgListBoxArray "dlbSource",Source_Array()
DlgValue "dlbSource",GetEnumIndex(Source_Enum)

DlgText "txtSelectedSource", GetSourceControllerFeedback(DlgText("dlbSource"))
Case 2 ' Value changing or button pressed
Rem SourceControllerFunction = True ' Prevent button press from closing the dialog box
Select Case DlgItem
Case "dlbSource"
DlgText "txtSelectedSource", GetSourceControllerFeedback(DlgText(DlgItem))
SourceControllerFunction = True
Case "btnOK"
SetEnumValue Source_Enum, DlgValue("dlbSource")
Set Source_Enum = Nothing
Case "CancelButton"
Set Source_Enum = Nothing
Case Else
End Select

Case 3 ' TextBox or ComboBox text changed
Case 4 ' Focus changed
Case 5 ' Idle
Rem Wait .1 : SourceControllerFunction = True ' Continue getting idle actions
Case 6 ' Function key
End Select
End Function

Private Function GetSourceControllerFeedback(Reference As String) As String
Select Case Reference
Case "Source 1"
GetSourceControllerFeedback = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(SOURCE_PATH & ".SOURCE1.NAME"))
Case "Source 2"
GetSourceControllerFeedback = GetDisplayString (GlobalTO.XRioDocument.GetParamFromIDs(SOURCE_PATH & ".SOURCE2.NAME"))
End Select
End Function



Comments

Popular posts from this blog

Micom SE Studio1 Import Filter - Creating User Interface (UI)

Welcome to my page and welcome to the continuation of Omicron Import Filter tutorial series. In this tutorial, I will show you how to create the actual import filter fom Micom relays. In this tutorial, we will focus on the Visual Studio program. We're going to modify the codes in our project called MyImportFilter that we've created in the previous tutorial.  Download the project in this link  MyImportFilter - Process Relay Setting Parameters . Extract and open the project. Once the project is loaded, add New Folder inside the project and set the name to SEStudio1. We need this to make organize our project class filter.  SE Studio 1 stands for Schneider Electric Studio 1 which is the software that used in communicating MiCOM relays particularly P12x series. And yes we're going to create a new import filter and user interface form MiCOM P12x series relay. I think this will applied to other MiCOM P series relay. Add a new Form inside the  SEStudio1 folder  and set the name to

Processing The Relay Setting Parameters In Omicron Import Filter

Welcome to my page and welcome to the fifth part of Omicron Import Filter tutorial series. In this tutorial, I will show you how to process the relay setting parameters that to be import in the Xrio converter. In this tutorial, we will focus on the Visual Studio program. We're going to modify the codes in our project called MyImportFilter that we've created in the previous tutorial.  Download the project in this link  MyImportFilter - Process Relay Setting Parameters . Extract and open the project. Once the project is loaded, add New Folder inside the project and set the name to SEStudio1. We need this to make organize our project class filter.  SE Studio 1 stands for Schneider Electric Studio 1 which is the software that used in communicating MiCOM relays particularly P12x series. And yes we're going to create a new import filter and user interface form MiCOM P12x series relay. I think this will applied to other MiCOM P series relay. Add a new Form inside the  SEStudio1 fo

Write An Encrypted Text File In Visual Basic

There are many ways to encrypt text or data. In this tutorial, DESCryptoServiceProvider class to encrypt and decrypt strings using the cryptographic service provider version of the Triple Data Encryption Standard algorithm. The use encryption to protect secret data and to make data unreadable by unauthorized users. Creating encryption wrapper Open the previous project from this tutorial  Write Text To File In Visual Basic  then rename it to WriteTextToFileWithEncryptionVB or create a new project. I recommend to open the existing project to easily follow this tutorial. Create the Encryption3DesWrapper class to implement the encryption and decryption methods. 1 2 3 Public NotInheritable Class Encryption3DesWrapper End Class Add an import of the cryptography namespace to the start of the file that contains the Encryption3DesWrapper class. 1 2 3 4 5 Imports System.Security.Cryptography Public Class Encryption3DesWrapper End Class In the Encryption3DesWr