Data Logging Groups

GetDataLoggingNames

  • The GetDataLoggingNames Function returns a list of the Data Logging Groups.
  • Returns Empty String Array if service is not reachable.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonGetDataLoggingNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLoggingNames.Click
 Cursor.Current = Cursors.WaitCursor
 ComboBoxGetDataLoggingNames.Items.Clear()
 Dim Groups() As String
 Dim Group As String
 Dim ErrorString As String = ""
 Groups = ModuleNetworkNode.OPCSystemsComponent1.GetDataLoggingNames(TextBoxNetworkNode.Text, ErrorString)
 If ErrorString = "Success" Then
 For Each Group In Groups
 ComboBoxGetDataLoggingNames.Items.Add(Group)
 Next
 If ComboBoxGetDataLoggingNames.Items.Count > 0 Then
 ComboBoxGetDataLoggingNames.SelectedIndex = 0
 End If
 Else
 MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
 End If
 End Sub

Private Sub ComboBoxGetDataLoggingNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetDataLoggingNames.SelectedIndexChanged
 TextBoxDataLoggingGroup.Text = ComboBoxGetDataLoggingNames.SelectedItem
 End Sub

C#

Private Sub ButtonGetDataLoggingNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLoggingNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetDataLoggingNames.Items.Clear()
        Dim Groups() As String
        Dim Group As String
        Dim ErrorString As String = ""
        Groups = ModuleNetworkNode.OPCSystemsComponent1.GetDataLoggingNames(TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each Group In Groups
                ComboBoxGetDataLoggingNames.Items.Add(Group)
            Next
            If ComboBoxGetDataLoggingNames.Items.Count > 0 Then
                ComboBoxGetDataLoggingNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
 
    Private Sub ComboBoxGetDataLoggingNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetDataLoggingNames.SelectedIndexChanged
        TextBoxDataLoggingGroup.Text = ComboBoxGetDataLoggingNames.SelectedItem
    End Sub

AddDataLoggingGroup

  • The AddDataLoggingGroup Function adds a Data Logging Group to the existing Data Logging configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the Group already exists or adding the Group failed.
  • Group is the name of the Group to add.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonAddDataLoggingGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddDataLoggingGroup.Click
 Cursor.Current = Cursors.WaitCursor
 Dim ResultInt32 As Int32
 Dim ErrorString As String = ""
 ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddDataLoggingGroup(TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 If ResultInt32 = -1 Then
 LabelAddDataLoggingGroupResult.Text = "OAS Service not reached."
 ElseIf ResultInt32 = 1 Then
 LabelAddDataLoggingGroupResult.Text = "Group successfully added."
 Else
 LabelAddDataLoggingGroupResult.Text = ErrorString
 End If
 End Sub

C#

 Private Sub ButtonAddDataLoggingGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddDataLoggingGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddDataLoggingGroup(TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelAddDataLoggingGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelAddDataLoggingGroupResult.Text = "Group successfully added."
        Else
            LabelAddDataLoggingGroupResult.Text = ErrorString
        End If
    End Sub

RemoveDataLoggingGroup

  • The RemoveDataLoggingGroup Function removes a Data Logging Group from the existing Data Logging configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the Group does not exist or removing the Group failed.
  • Group is the name of the Group to remove.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonRemoveDataLoggingGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRemoveDataLoggingGroup.Click
 Cursor.Current = Cursors.WaitCursor
 Dim ResultInt32 As Int32
 Dim ErrorString As String = ""
 ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveDataLoggingGroup(TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 If ResultInt32 = -1 Then
 LabelRemoveDataLoggingGroupResult.Text = "OAS Service not reached."
 ElseIf ResultInt32 = 1 Then
 LabelRemoveDataLoggingGroupResult.Text = "Group successfully removed."
 Else
 LabelRemoveDataLoggingGroupResult.Text = ErrorString
 End If
 End Sub

C#

 Private Sub ButtonRemoveDataLoggingGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRemoveDataLoggingGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveDataLoggingGroup(TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelRemoveDataLoggingGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelRemoveDataLoggingGroupResult.Text = "Group successfully removed."
        Else
            LabelRemoveDataLoggingGroupResult.Text = ErrorString
        End If
    End Sub

GetDataLoggingParameterStrings

  • The GetDataLoggingParameterStrings Function returns an array of Strings containing all property types available for each Data Logging Group.
  • Returns Empty String Array if service is not reachable.
  • Returns a String Array of property types for all possible Parameters for a Data Logging Group.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.

VB

Private Sub ButtonGetDataLoggingParameterStrings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLoggingParameterStrings.Click
 Cursor.Current = Cursors.WaitCursor
 ComboBoxGetDataLoggingParameterStrings.Items.Clear()
 Dim Parameters() As String
 Dim Parameter As String
 Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetDataLoggingParameterStrings(TextBoxNetworkNode.Text)
 For Each Parameter In Parameters
 ComboBoxGetDataLoggingParameterStrings.Items.Add(Parameter)
 Next
 If ComboBoxGetDataLoggingParameterStrings.Items.Count > 0 Then
 ComboBoxGetDataLoggingParameterStrings.SelectedIndex = 0
 End If
 End Sub

Private Sub ComboBoxGetDataLoggingParameterStrings_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetDataLoggingParameterStrings.SelectedIndexChanged
 TextBoxParameter.Text = ComboBoxGetDataLoggingParameterStrings.SelectedItem
 End Sub

C#

Private Sub ButtonGetDataLoggingParameterStrings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLoggingParameterStrings.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetDataLoggingParameterStrings.Items.Clear()
        Dim Parameters() As String
        Dim Parameter As String
        Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetDataLoggingParameterStrings(TextBoxNetworkNode.Text)
        For Each Parameter In Parameters
            ComboBoxGetDataLoggingParameterStrings.Items.Add(Parameter)
        Next
        If ComboBoxGetDataLoggingParameterStrings.Items.Count > 0 Then
            ComboBoxGetDataLoggingParameterStrings.SelectedIndex = 0
        End If
    End Sub
 
    Private Sub ComboBoxGetDataLoggingParameterStrings_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetDataLoggingParameterStrings.SelectedIndexChanged
        TextBoxParameter.Text = ComboBoxGetDataLoggingParameterStrings.SelectedItem
    End Sub

GetDataLogging_Parameter_Value

  • The GetDataLogging_Parameter_Value Function returns an object value for the Data Logging Group and Parameter specified.
  • Returns nothing if service is not reachable.
  • Parameter is a String of the Parameter Type desired of the Data Logging Group.
  • Group is a String of the Data Logging Group desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonGetDataLogging_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLogging_Parameter_Value.Click
 Cursor.Current = Cursors.WaitCursor
 Dim ResultObject As Object
 Dim ErrorString As String = ""
 ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetDataLogging_Parameter_Value(TextBoxParameter.Text, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 If ErrorString = "Success" Then
 Try
 If TextBoxParameter.Text = "DBFields" Then
 Try
 Dim DBFieldsArray() As Object
 DBFieldsArray = ResultObject
 Dim Version As Int32
 Dim NumberOfFields As Int32
 Dim FieldNames() As String
 Dim TagNames() As Array
 Array of Strings
 Dim NewTags(-1) As String
 Dim DataTypes() As String
 Dim TextLengths() As Int32
 Dim Index As Int32
 Dim BaseIndex As Int32
 Dim TagIndex As Int32
 Version = DBFieldsArray(0)
 2 is the current version to use.
 NumberOfFields = DBFieldsArray(1)
 If Version >= 1 Then

If Version >= 2 Then
 Current version of DBFields type

End If

ReDim FieldNames(NumberOfFields - 1)
 ReDim TagNames(NumberOfFields - 1)
 ReDim DataTypes(NumberOfFields - 1)
 ReDim TextLengths(NumberOfFields - 1)
 BaseIndex = 2
 For Index = 0 To NumberOfFields - 1
 FieldNames(Index) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 Next
 If Version >= 2 Then
 For Index = 0 To NumberOfFields - 1
 TagNames(Index) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 Next
 Else
 ReDim NewTags(0)
 For Index = 0 To NumberOfFields - 1
 NewTags(0) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 TagNames(Index) = NewTags
 Next
 End If
 For Index = 0 To NumberOfFields - 1
 Select Case DBFieldsArray(BaseIndex).ToString
 Case "Boolean"
 DataTypes(Index) = "Boolean"
 Case "Double"
 DataTypes(Index) = "Double"
 Case "Integer"
 DataTypes(Index) = "Integer"
 Case "String"
 DataTypes(Index) = "String"
 Case "Date/Time"
 DataTypes(Index) = "Date/Time"
 End Select
 BaseIndex += 1
 Next
 For Index = 0 To NumberOfFields - 1
 TextLengths(Index) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 Next
 Dim ResultString As String
 ResultString = "Version: " + Version.ToString
 ResultString += " Number Of Fields: " + NumberOfFields.ToString
 If NumberOfFields > 0 Then
 For Index = 0 To NumberOfFields - 1
 ResultString += " Field" + Index.ToString + ": " + FieldNames(Index)
 NewTags = TagNames(Index)
 For TagIndex = 0 To NewTags.GetLength(0) - 1
 ResultString += " Tag" + TagIndex.ToString + ": " + NewTags(TagIndex)
 Next
 ResultString += " DataType" + Index.ToString + ": " + DataTypes(Index)
 ResultString += " Text Length" + Index.ToString + ": " + TextLengths(Index).ToString
 Next
 End If
 LabelGetDataLogging_Parameter_ValueResult.Text = ResultString
 TextBoxValueToSet.Text = ResultString
 End If
 Catch ex As Exception
 LabelGetDataLogging_Parameter_ValueResult.Text = "Error converting value to string."
 TextBoxValueToSet.Text = ""
 End Try
 ElseIf TextBoxParameter.Text = "DataChangeTagsWithAlias" Then
 Try
 Dim TagsAndAliases() As String
 TagsAndAliases = ResultObject
 Dim ResultString As String = ""
 If Not (TagsAndAliases Is Nothing) Then
 Dim NumberOfTags As Int32
 NumberOfTags = TagsAndAliases.GetLength(0) / 2
 Dim Index As Int32
 For Index = 0 To NumberOfTags - 1
 ResultString += "Tag: " + TagsAndAliases(Index * 2) + " Alias: " + TagsAndAliases(Index * 2 + 1) + " - "
 Next
 LabelGetDataLogging_Parameter_ValueResult.Text = ResultString
 End If
 Catch ex As Exception
 LabelGetDataLogging_Parameter_ValueResult.Text = "Error converting value to string."
 TextBoxValueToSet.Text = ""
 End Try
 Else
 LabelGetDataLogging_Parameter_ValueResult.Text = ResultObject
 TextBoxValueToSet.Text = ResultObject
 End If
 Catch ex As Exception
 LabelGetDataLogging_Parameter_ValueResult.Text = "Error converting value to string."
 TextBoxValueToSet.Text = ""
 End Try
 Else
 LabelGetDataLogging_Parameter_ValueResult.Text = ErrorString
 TextBoxValueToSet.Text = ""
 End If
 End Sub

C#

 Private Sub ButtonGetDataLogging_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLogging_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultObject As Object
        Dim ErrorString As String = ""
        ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetDataLogging_Parameter_Value(TextBoxParameter.Text, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            Try
                If TextBoxParameter.Text = "DBFields" Then
                    Try
                        Dim DBFieldsArray() As Object
                        DBFieldsArray = ResultObject
                        Dim Version As Int32
                        Dim NumberOfFields As Int32
                        Dim FieldNames() As String
                        Dim TagNames() As Array ' Array of Strings
                        Dim NewTags(-1) As String
                        Dim DataTypes() As String
                        Dim TextLengths() As Int32
                        Dim Index As Int32
                        Dim BaseIndex As Int32
                        Dim TagIndex As Int32
                        Version = DBFieldsArray(0)  ' 2 is the current version to use.
                        NumberOfFields = DBFieldsArray(1)
                        If Version >= 1 Then
 
                            If Version >= 2 Then    ' Current version of DBFields type
 
 
                            End If
 
                            ReDim FieldNames(NumberOfFields - 1)
                            ReDim TagNames(NumberOfFields - 1)
                            ReDim DataTypes(NumberOfFields - 1)
                            ReDim TextLengths(NumberOfFields - 1)
                            BaseIndex = 2
                            For Index = 0 To NumberOfFields - 1
                                FieldNames(Index) = DBFieldsArray(BaseIndex)
                                BaseIndex += 1
                            Next
                            If Version >= 2 Then
                                For Index = 0 To NumberOfFields - 1
                                    TagNames(Index) = DBFieldsArray(BaseIndex)
                                    BaseIndex += 1
                                Next
                            Else
                                ReDim NewTags(0)
                                For Index = 0 To NumberOfFields - 1
                                    NewTags(0) = DBFieldsArray(BaseIndex)
                                    BaseIndex += 1
                                    TagNames(Index) = NewTags
                                Next
                            End If
                            For Index = 0 To NumberOfFields - 1
                                Select Case DBFieldsArray(BaseIndex).ToString
                                    Case "Boolean"
                                        DataTypes(Index) = "Boolean"
                                    Case "Double"
                                        DataTypes(Index) = "Double"
                                    Case "Integer"
                                        DataTypes(Index) = "Integer"
                                    Case "String"
                                        DataTypes(Index) = "String"
                                    Case "Date/Time"
                                        DataTypes(Index) = "Date/Time"
                                End Select
                                BaseIndex += 1
                            Next
                            For Index = 0 To NumberOfFields - 1
                                TextLengths(Index) = DBFieldsArray(BaseIndex)
                                BaseIndex += 1
                            Next
                            Dim ResultString As String
                            ResultString = "Version: " + Version.ToString
                            ResultString += " Number Of Fields: " + NumberOfFields.ToString
                            If NumberOfFields > 0 Then
                                For Index = 0 To NumberOfFields - 1
                                    ResultString += " Field" + Index.ToString + ": " + FieldNames(Index)
                                    NewTags = TagNames(Index)
                                    For TagIndex = 0 To NewTags.GetLength(0) - 1
                                        ResultString += " Tag" + TagIndex.ToString + ": " + NewTags(TagIndex)
                                    Next
                                    ResultString += " DataType" + Index.ToString + ": " + DataTypes(Index)
                                    ResultString += " Text Length" + Index.ToString + ": " + TextLengths(Index).ToString
                                Next
                            End If
                            LabelGetDataLogging_Parameter_ValueResult.Text = ResultString
                            TextBoxValueToSet.Text = ResultString
                        End If
                    Catch ex As Exception
                        LabelGetDataLogging_Parameter_ValueResult.Text = "Error converting value to string."
                        TextBoxValueToSet.Text = ""
                    End Try
                ElseIf TextBoxParameter.Text = "DataChangeTagsWithAlias" Then
                    Try
                        Dim TagsAndAliases() As String
                        TagsAndAliases = ResultObject
                        Dim ResultString As String = ""
                        If Not (TagsAndAliases Is Nothing) Then
                            Dim NumberOfTags As Int32
                            NumberOfTags = TagsAndAliases.GetLength(0) / 2
                            Dim Index As Int32
                            For Index = 0 To NumberOfTags - 1
                                ResultString += "Tag: " + TagsAndAliases(Index * 2) + " Alias: " + TagsAndAliases(Index * 2 + 1) + " - "
                            Next
                            LabelGetDataLogging_Parameter_ValueResult.Text = ResultString
                        End If
                    Catch ex As Exception
                        LabelGetDataLogging_Parameter_ValueResult.Text = "Error converting value to string."
                        TextBoxValueToSet.Text = ""
                    End Try
                Else
                    LabelGetDataLogging_Parameter_ValueResult.Text = ResultObject
                    TextBoxValueToSet.Text = ResultObject
                End If
            Catch ex As Exception
                LabelGetDataLogging_Parameter_ValueResult.Text = "Error converting value to string."
                TextBoxValueToSet.Text = ""
            End Try
        Else
            LabelGetDataLogging_Parameter_ValueResult.Text = ErrorString
            TextBoxValueToSet.Text = ""
        End If
    End Sub

GetDataLogging_Parameter_Values

  • The GetDataLogging_Parameter_Values Function returns an array of object values for the Data Logging Group specified.
  • The order of the array corresponds with the GetDataLoggingParameterStrings Function order.
  • Returns empty array if service is not reachable.
  • Group is a String of the Data Logging Group desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonGetDataLogging_Parameter_Values_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLogging_Parameter_Values.Click
 Cursor.Current = Cursors.WaitCursor
 ComboBoxGetDataLogging_Parameter_Values.Items.Clear()
 Dim ResultObjects() As Object
 Dim ResultObject As Object
 Dim ResultString As String = ""
 Dim ParameterIndex As Int32 = 0
 Dim ErrorString As String = ""
 ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetDataLogging_Parameter_Values(TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 If ErrorString = "Success" Then
 For Each ResultObject In ResultObjects
 Try
 If ResultObject Is Nothing Then
 ResultString = ""
 Else
 If ParameterIndex = 2 Then
 DBFields type
 Try
 Dim DBFieldsArray() As Object
 DBFieldsArray = ResultObject
 Dim Version As Int32
 Dim NumberOfFields As Int32
 Dim FieldNames() As String
 Dim TagNames() As Array
 Array of Strings
 Dim NewTags(-1) As String
 Dim DataTypes() As String
 Dim TextLengths() As Int32
 Dim Index As Int32
 Dim BaseIndex As Int32
 Dim TagIndex As Int32
 Version = DBFieldsArray(0)
 2 is the current version to use.
 NumberOfFields = DBFieldsArray(1)
 If Version >= 1 Then

If Version >= 2 Then
 Current version of DBFields type

End If

ReDim FieldNames(NumberOfFields - 1)
 ReDim TagNames(NumberOfFields - 1)
 ReDim DataTypes(NumberOfFields - 1)
 ReDim TextLengths(NumberOfFields - 1)
 BaseIndex = 2
 For Index = 0 To NumberOfFields - 1
 FieldNames(Index) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 Next
 If Version >= 2 Then
 For Index = 0 To NumberOfFields - 1
 TagNames(Index) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 Next
 Else
 ReDim NewTags(0)
 For Index = 0 To NumberOfFields - 1
 NewTags(0) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 TagNames(Index) = NewTags
 Next
 End If
 For Index = 0 To NumberOfFields - 1
 Select Case DBFieldsArray(BaseIndex).ToString
 Case "Boolean"
 DataTypes(Index) = "Boolean"
 Case "Double"
 DataTypes(Index) = "Double"
 Case "Integer"
 DataTypes(Index) = "Integer"
 Case "String"
 DataTypes(Index) = "String"
 Case "Date/Time"
 DataTypes(Index) = "Date/Time"
 End Select
 BaseIndex += 1
 Next
 For Index = 0 To NumberOfFields - 1
 TextLengths(Index) = DBFieldsArray(BaseIndex)
 BaseIndex += 1
 Next

ResultString = "Version: " + Version.ToString
 ResultString += " Number Of Fields: " + NumberOfFields.ToString
 If NumberOfFields > 0 Then
 For Index = 0 To NumberOfFields - 1
 ResultString += " Field" + Index.ToString + ": " + FieldNames(Index)
 NewTags = TagNames(Index)
 For TagIndex = 0 To NewTags.GetLength(0) - 1
 ResultString += " Tag" + TagIndex.ToString + ": " + NewTags(TagIndex)
 Next
 ResultString += " DataType" + Index.ToString + ": " + DataTypes(Index)
 ResultString += " Text Length" + Index.ToString + ": " + TextLengths(Index).ToString
 Next
 End If
 End If
 Catch ex As Exception
 ResultString = "Error converting value to string."
 End Try
 Else
 ResultString = ResultObject
 End If
 End If
 ComboBoxGetDataLogging_Parameter_Values.Items.Add(ResultString)
 Catch ex As Exception
 ComboBoxGetDataLogging_Parameter_Values.Items.Add("Error Converting Object")
 End Try
 ParameterIndex += 1
 Next
 If ComboBoxGetDataLogging_Parameter_Values.Items.Count > 0 Then
 ComboBoxGetDataLogging_Parameter_Values.SelectedIndex = 0
 End If
 Else
 MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
 End If
 End Sub

C#


C#

 Private Sub ButtonGetDataLogging_Parameter_Values_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLogging_Parameter_Values.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetDataLogging_Parameter_Values.Items.Clear()
        Dim ResultObjects() As Object
        Dim ResultObject As Object
        Dim ResultString As String = ""
        Dim ParameterIndex As Int32 = 0
        Dim ErrorString As String = ""
        ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetDataLogging_Parameter_Values(TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each ResultObject In ResultObjects
                Try
                    If ResultObject Is Nothing Then
                        ResultString = ""
                    Else
                        If ParameterIndex = 2 Then   ' DBFields type
                            Try
                                Dim DBFieldsArray() As Object
                                DBFieldsArray = ResultObject
                                Dim Version As Int32
                                Dim NumberOfFields As Int32
                                Dim FieldNames() As String
                                Dim TagNames() As Array ' Array of Strings
                                Dim NewTags(-1) As String
                                Dim DataTypes() As String
                                Dim TextLengths() As Int32
                                Dim Index As Int32
                                Dim BaseIndex As Int32
                                Dim TagIndex As Int32
                                Version = DBFieldsArray(0)  ' 2 is the current version to use.
                                NumberOfFields = DBFieldsArray(1)
                                If Version >= 1 Then
 
                                    If Version >= 2 Then    ' Current version of DBFields type
 
 
                                    End If
 
                                    ReDim FieldNames(NumberOfFields - 1)
                                    ReDim TagNames(NumberOfFields - 1)
                                    ReDim DataTypes(NumberOfFields - 1)
                                    ReDim TextLengths(NumberOfFields - 1)
                                    BaseIndex = 2
                                    For Index = 0 To NumberOfFields - 1
                                        FieldNames(Index) = DBFieldsArray(BaseIndex)
                                        BaseIndex += 1
                                    Next
                                    If Version >= 2 Then
                                        For Index = 0 To NumberOfFields - 1
                                            TagNames(Index) = DBFieldsArray(BaseIndex)
                                            BaseIndex += 1
                                        Next
                                    Else
                                        ReDim NewTags(0)
                                        For Index = 0 To NumberOfFields - 1
                                            NewTags(0) = DBFieldsArray(BaseIndex)
                                            BaseIndex += 1
                                            TagNames(Index) = NewTags
                                        Next
                                    End If
                                    For Index = 0 To NumberOfFields - 1
                                        Select Case DBFieldsArray(BaseIndex).ToString
                                            Case "Boolean"
                                                DataTypes(Index) = "Boolean"
                                            Case "Double"
                                                DataTypes(Index) = "Double"
                                            Case "Integer"
                                                DataTypes(Index) = "Integer"
                                            Case "String"
                                                DataTypes(Index) = "String"
                                            Case "Date/Time"
                                                DataTypes(Index) = "Date/Time"
                                        End Select
                                        BaseIndex += 1
                                    Next
                                    For Index = 0 To NumberOfFields - 1
                                        TextLengths(Index) = DBFieldsArray(BaseIndex)
                                        BaseIndex += 1
                                    Next
 
                                    ResultString = "Version: " + Version.ToString
                                    ResultString += " Number Of Fields: " + NumberOfFields.ToString
                                    If NumberOfFields > 0 Then
                                        For Index = 0 To NumberOfFields - 1
                                            ResultString += " Field" + Index.ToString + ": " + FieldNames(Index)
                                            NewTags = TagNames(Index)
                                            For TagIndex = 0 To NewTags.GetLength(0) - 1
                                                ResultString += " Tag" + TagIndex.ToString + ": " + NewTags(TagIndex)
                                            Next
                                            ResultString += " DataType" + Index.ToString + ": " + DataTypes(Index)
                                            ResultString += " Text Length" + Index.ToString + ": " + TextLengths(Index).ToString
                                        Next
                                    End If
                                End If
                            Catch ex As Exception
                                ResultString = "Error converting value to string."
                            End Try
                        Else
                            ResultString = ResultObject
                        End If
                    End If
                    ComboBoxGetDataLogging_Parameter_Values.Items.Add(ResultString)
                Catch ex As Exception
                    ComboBoxGetDataLogging_Parameter_Values.Items.Add("Error Converting Object")
                End Try
                ParameterIndex += 1
            Next
            If ComboBoxGetDataLogging_Parameter_Values.Items.Count > 0 Then
                ComboBoxGetDataLogging_Parameter_Values.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

SetDataLogging_Parameter_Value

  • The SetDataLogging_Parameter_Value Function sets an object value for the Data Logging Group and Parameter specified.
  • Returns -1 if service is not reachable.
  • Returns 0 if the Group does not exist or the value did not get set correctly.
  • Returns 1 if the function was successful.
  • Parameter is a String of the Parameter Type desired of the Data Logging Group.
  • Value is the desired value to set.
  • Group is a String of the Data Logging Group desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonSetDataLogging_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSetDataLogging_Parameter_Value.Click
 Cursor.Current = Cursors.WaitCursor
 Dim ResultInt32 As Int32
 Dim ErrorString As String = ""
 If TextBoxParameter.Text = "DBFields" Then
 Dim ArrayToSend(9) As Object
 Dim TagsToSend() As String
 ArrayToSend(0) = 2
 Version
 ArrayToSend(1) = 2
 Number of Fields
 ArrayToSend(2) = "Field01"
 First Field Name
 ArrayToSend(3) = "Field02"
 Second Field Name
 ReDim TagsToSend(0)
 Example of one Tag per field for Field01
 TagsToSend(0) = "Ramp.Value"
 ArrayToSend(4) = TagsToSend
 ReDim TagsToSend(1)
 Example of multiple Tags per field for Field02
 TagsToSend(0) = "Sine.Value"
 TagsToSend(1) = "Random.Value"
 ArrayToSend(5) = TagsToSend
 ArrayToSend(6) = "Double"
 Data Type for first field
 ArrayToSend(7) = "Double"
 Data Type fo second field
 ArrayToSend(8) = 100
 Length of text for first field if String field
 ArrayToSend(9) = 100
 Length of text for second field if String field

ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetDataLogging_Parameter_Value(TextBoxParameter.Text, ArrayToSend, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 Else
 If TextBoxParameter.Text = "DataChangeTagsWithAlias" Then
 Dim ArrayToSend(5) As String
 Array of Tags and Aliases
 ArrayToSend(0) = "Ramp.Value"
 Tag Name
 ArrayToSend(1) = "Ramp"
 Alias Name
 ArrayToSend(2) = "Sine.Value"
 Tag Name
 ArrayToSend(3) = "Sine"
 Alias Name
 ArrayToSend(4) = "Random.Value"
 Tag Name
 ArrayToSend(5) = "Random"
 Alias Name
 ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetDataLogging_Parameter_Value(TextBoxParameter.Text, ArrayToSend, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 Else
 ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetDataLogging_Parameter_Value(TextBoxParameter.Text, TextBoxValueToSet.Text, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 End If
 End If

If ResultInt32 = -1 Then
 LabelSetDataLogging_Parameter_ValueResult.Text = "OAS Service not reached."
 ElseIf ResultInt32 = 1 Then
 LabelSetDataLogging_Parameter_ValueResult.Text = "Parameter Successfully Updated."
 Else
 LabelSetDataLogging_Parameter_ValueResult.Text = ErrorString
 End If
 End Sub

C#

  Private Sub ButtonSetDataLogging_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSetDataLogging_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        If TextBoxParameter.Text = "DBFields" Then
            Dim ArrayToSend(9) As Object
            Dim TagsToSend() As String
            ArrayToSend(0) = 2 ' Version
            ArrayToSend(1) = 2 ' Number of Fields
            ArrayToSend(2) = "Field01" ' First Field Name
            ArrayToSend(3) = "Field02" ' Second Field Name
            ReDim TagsToSend(0) ' Example of one Tag per field for Field01
            TagsToSend(0) = "Ramp.Value"
            ArrayToSend(4) = TagsToSend
            ReDim TagsToSend(1) ' Example of multiple Tags per field for Field02
            TagsToSend(0) = "Sine.Value"
            TagsToSend(1) = "Random.Value"
            ArrayToSend(5) = TagsToSend
            ArrayToSend(6) = "Double"   ' Data Type for first field
            ArrayToSend(7) = "Double"   ' Data Type fo second field
            ArrayToSend(8) = 100  ' Length of text for first field if String field
            ArrayToSend(9) = 100  ' Length of text for second field if String field
 
            ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetDataLogging_Parameter_Value(TextBoxParameter.Text, ArrayToSend, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        Else
            If TextBoxParameter.Text = "DataChangeTagsWithAlias" Then
                Dim ArrayToSend(5) As String  ' Array of Tags and Aliases
                ArrayToSend(0) = "Ramp.Value" ' Tag Name
                ArrayToSend(1) = "Ramp" ' Alias Name
                ArrayToSend(2) = "Sine.Value" ' Tag Name
                ArrayToSend(3) = "Sine" ' Alias Name
                ArrayToSend(4) = "Random.Value" ' Tag Name
                ArrayToSend(5) = "Random" ' Alias Name
                ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetDataLogging_Parameter_Value(TextBoxParameter.Text, ArrayToSend, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
            Else
                ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetDataLogging_Parameter_Value(TextBoxParameter.Text, TextBoxValueToSet.Text, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
            End If
        End If
 
        If ResultInt32 = -1 Then
            LabelSetDataLogging_Parameter_ValueResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelSetDataLogging_Parameter_ValueResult.Text = "Parameter Successfully Updated."
        Else
            LabelSetDataLogging_Parameter_ValueResult.Text = ErrorString
        End If
    End Sub

SaveDataLoggingConfiguration

  • The SaveDataLoggingConfiguration Subroutine saves the current Data Logging configuration to the specified file path.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonSaveDataLoggingConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSaveDataLoggingConfiguration.Click
 Cursor.Current = Cursors.WaitCursor
 Dim ErrorString As String = ""
 ModuleNetworkNode.OPCSystemsComponent1.SaveDataLoggingConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
 If ErrorString <> "Success" Then
 MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
 End If
 End Sub

C#


LoadDataLoggingConfiguration

  • The LoadDataLoggingConfiguration Subroutine saves the current Data Logging configuration to the specified file path.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonLoadDataLoggingConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoadDataLoggingConfiguration.Click
 Cursor.Current = Cursors.WaitCursor
 Dim ErrorString As String = ""
 ModuleNetworkNode.OPCSystemsComponent1.LoadDataLoggingConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
 If ErrorString <> "Success" Then
 MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
 End If
 End Sub

C#


AddDataLoggingField

  • The AddDataLoggingField Function adds just one field to an existing Data Logging Group specified that is a wide table format.
  • Returns -1 if service is not reachable.
  • Returns 0 if the Group does not exist or the value did not get set correctly.
  • Returns 1 if the function was successful.
  • FieldName is the field name to add to the logging group.
  • TagName is the tag name to assign to the field.
  • DataType is a string of the field data type.
  • StringLength is the length of the string field if the data type is a string.
  • Group is a String of the Data Logging Group desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • ErrorString will be set to Success when function is successful and an error message when in error.
  • RemoteSCADAHostingName is the name of the Live Data Cloud OAS Service to connect to.

VB

Private Sub ButtonAddDataLoggingField_Click(sender As System.Object, e As System.EventArgs) Handles ButtonAddDataLoggingField.Click
 Cursor.Current = Cursors.WaitCursor
 Dim ResultInt32 As Int32
 Dim ErrorString As String = ""

ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddDataLoggingField(TextBoxFieldNameToAdd.Text, TextBoxTagNameToAdd.Text, "Double", 100, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
 If ResultInt32 = -1 Then
 LabelAddDataLoggingFieldResult.Text = "OAS Service not reached."
 ElseIf ResultInt32 = 1 Then
 LabelAddDataLoggingFieldResult.Text = "Parameter Successfully Updated."
 Else
 LabelAddDataLoggingFieldResult.Text = ErrorString
 End If
 End Sub

C#

 Private Sub ButtonSaveDataLoggingConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSaveDataLoggingConfiguration.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ErrorString As String = ""
        ModuleNetworkNode.OPCSystemsComponent1.SaveDataLoggingConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString <> "Success" Then
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
 
    ' The LoadDataLoggingConfiguration Subroutine saves the current Data Logging configuration to the specified file path.
    ' NetworkNode is the name of the network node of the OAS Service to connect to.  Leave blank for localhost connection.
    ' Optional ErrorString will be set to Success when function is successful and an error message when in error.
    Private Sub ButtonLoadDataLoggingConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoadDataLoggingConfiguration.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ErrorString As String = ""
        ModuleNetworkNode.OPCSystemsComponent1.LoadDataLoggingConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString <> "Success" Then
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
 
    ' The AddDataLoggingField Function adds just one field to an existing Data Logging Group specified that is a wide table format.
    ' Returns -1 if service is not reachable.
    ' Returns 0 if the Group does not exist or the value did not get set correctly.
    ' Returns 1 if the function was successful.
    ' FieldName is the field name to add to the logging group.
    ' TagName is the tag name to assign to the field.
    ' DataType is a string of the field data type.
    ' StringLength is the length of the string field if the data type is a string.
    ' Group is a String of the Data Logging Group desired.
    ' NetworkNode is the name of the network node of the OAS Service to connect to.  Leave blank for localhost connection.
    ' ErrorString will be set to Success when function is successful and an error message when in error.
    ' RemoteSCADAHostingName is the name of the Live Data Cloud OAS Service to connect to.
    Private Sub ButtonAddDataLoggingField_Click(sender As System.Object, e As System.EventArgs) Handles ButtonAddDataLoggingField.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
 
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddDataLoggingField(TextBoxFieldNameToAdd.Text, TextBoxTagNameToAdd.Text, "Double", 100, TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelAddDataLoggingFieldResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelAddDataLoggingFieldResult.Text = "Parameter Successfully Updated."
        Else
            LabelAddDataLoggingFieldResult.Text = ErrorString
        End If
    End Sub