Report Groups

GetReportNames

  • The GetReportNames Function returns a list of the Report 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 ButtonGetReportNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetReportNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetReportNames.Items.Clear()
        Dim Groups() As String
        Dim Group As String
        Dim ErrorString As String = ""
        Groups = ModuleNetworkNode.OPCSystemsComponent1.GetReportNames(TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each Group In Groups
                ComboBoxGetReportNames.Items.Add(Group)
            Next
            If ComboBoxGetReportNames.Items.Count > 0 Then
                ComboBoxGetReportNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
 
        Private Sub ComboBoxGetReportNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetReportNames.SelectedIndexChanged
        TextBoxReportGroup.Text = ComboBoxGetReportNames.SelectedItem
    End Sub
 

C#

	     private void ButtonGetReportNames_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetReportNames.Items.Clear();
                     string[] Groups = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string Group = null;
                     string ErrorString = "";
                     Groups = ModuleNetworkNode.OPCSystemsComponent1.GetReportNames(TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (string Group in Groups)
                           {
                                  ComboBoxGetReportNames.Items.Add(Group);
                           }
                           if (ComboBoxGetReportNames.Items.Count > 0)
                           {
                                  ComboBoxGetReportNames.SelectedIndex = 0;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }
 
              private void ComboBoxGetReportNames_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxReportGroup.Text = ComboBoxGetReportNames.SelectedItem.ToString();
              }
   

AddReportGroup

  • The AddReportGroup Function adds a Report Group to the existing Report 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 ButtonAddReportGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddReportGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddReportGroup(TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelAddReportGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelAddReportGroupResult.Text = "Group successfully added."
        Else
            LabelAddReportGroupResult.Text = ErrorString
        End If
    End Sub

C#

	       private void ButtonAddReportGroup_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddReportGroup(TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelAddReportGroupResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelAddReportGroupResult.Text = "Group successfully added.";
                     }
                     else
                     {
                           LabelAddReportGroupResult.Text = ErrorString;
                     }
              }   

RemoveReportGroup

  • The RemoveReportGroup Function removes a Report Group from the existing Report 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 ButtonRemoveReportGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRemoveReportGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveReportGroup(TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelRemoveReportGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelRemoveReportGroupResult.Text = "Group successfully removed."
        Else
            LabelRemoveReportGroupResult.Text = ErrorString
        End If
    End Sub

C#

	      private void ButtonRemoveReportGroup_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveReportGroup(TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelRemoveReportGroupResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelRemoveReportGroupResult.Text = "Group successfully removed.";
                     }
                     else
                     {
                           LabelRemoveReportGroupResult.Text = ErrorString;
                     }
              }
  

GetReportParameterStrings

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

VB

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

C#

	     private void ButtonGetReportParameterStrings_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetReportParameterStrings.Items.Clear();
                     string[] Parameters = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string Parameter = null;
                     Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetReportParameterStrings(TextBoxNetworkNode.Text);
                     foreach (string Parameter in Parameters)
                     {
                           ComboBoxGetReportParameterStrings.Items.Add(Parameter);
                     }
                     if (ComboBoxGetReportParameterStrings.Items.Count > 0)
                     {
                           ComboBoxGetReportParameterStrings.SelectedIndex = 1;
                     }
              }
 
              private void ComboBoxGetReportParameterStrings_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxParameter.Text = ComboBoxGetReportParameterStrings.SelectedItem.ToString();
              }

GetReport_Parameter_Value

  • The GetReport_Parameter_Value Function returns an object value for the Report Group and Parameter specified.
  • Returns nothing if service is not reachable.
  • Parameter is a String of the Parameter Type desired of the Report Group.
  • Group is a String of the Report 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 ButtonGetReport_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetReport_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultObject As Object
        Dim ErrorString As String = ""
        ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetReport_Parameter_Value(TextBoxParameter.Text, TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            Try
                LabelGetReport_Parameter_ValueResult.Text = ResultObject
                TextBoxValueToSet.Text = ResultObject
            Catch ex As Exception
                LabelGetReport_Parameter_ValueResult.Text = "Error converting value to string."
                TextBoxValueToSet.Text = ""
            End Try
        Else
            LabelGetReport_Parameter_ValueResult.Text = ErrorString
            TextBoxValueToSet.Text = ""
        End If
    End Sub
 

C#

	       private void ButtonGetReport_Parameter_Value_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     object ResultObject = null;
                     string ErrorString = "";
                     ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetReport_Parameter_Value(TextBoxParameter.Text, TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           try
                           {
                                  LabelGetReport_Parameter_ValueResult.Text = ResultObject.ToString();
                                  TextBoxValueToSet.Text = ResultObject.ToString();
                           }
                           catch (Exception ex)
                           {
                                  LabelGetReport_Parameter_ValueResult.Text = "Error converting value to string.";
                                  TextBoxValueToSet.Text = "";
                           }
                     }
                     else
                     {
                           LabelGetReport_Parameter_ValueResult.Text = ErrorString;
                           TextBoxValueToSet.Text = "";
                     }
              }

GetReport_Parameter_Values

  • The GetReport_Parameter_Values Function returns an array of object values for the Report Group specified.
  • The order of the array corresponds with the GetReportParameterStrings Function order.
  • Returns empty array if service is not reachable.
  • Group is a String of the Report 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 ButtonGetReport_Parameter_Values_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetReport_Parameter_Values.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetReport_Parameter_Values.Items.Clear()
        Dim ResultObjects() As Object
        Dim ResultObject As Object
        Dim ResultString As String
        Dim ErrorString As String = ""
        ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetReport_Parameter_Values(TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each ResultObject In ResultObjects
                Try
                    If ResultObject Is Nothing Then
                        ResultString = ""
                    Else
                        ResultString = ResultObject
                    End If
                    ComboBoxGetReport_Parameter_Values.Items.Add(ResultString)
                Catch ex As Exception
                    ComboBoxGetReport_Parameter_Values.Items.Add("Error Converting Object")
                End Try
            Next
            If ComboBoxGetReport_Parameter_Values.Items.Count > 0 Then
                ComboBoxGetReport_Parameter_Values.SelectedIndex = 1
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

	       private void ButtonGetReport_Parameter_Values_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetReport_Parameter_Values.Items.Clear();
                     object[] ResultObjects = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   object ResultObject = null;
                     string ResultString = null;
                     string ErrorString = "";
                     ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetReport_Parameter_Values(TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (object ResultObject in ResultObjects)
                           {
                                  try
                                  {
                                         if (ResultObject == null)
                                         {
                                                ResultString = "";
                                         }
                                         else
                                         {
                                                ResultString = ResultObject.ToString();
                                         }
                                         ComboBoxGetReport_Parameter_Values.Items.Add(ResultString);
                                  }
                                  catch (Exception ex)
                                  {
                                         ComboBoxGetReport_Parameter_Values.Items.Add("Error Converting Object");
                                  }
                           }
                           if (ComboBoxGetReport_Parameter_Values.Items.Count > 0)
                           {
                                  ComboBoxGetReport_Parameter_Values.SelectedIndex = 1;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }

SetReport_Parameter_Value

  • The SetReport_Parameter_Value Function sets an object value for the Report 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 Report Group.
  • Value is the desired value to set.
  • Group is a String of the Report 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 ButtonSetReport_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSetReport_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetReport_Parameter_Value(TextBoxParameter.Text, TextBoxValueToSet.Text, TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelSetReport_Parameter_ValueResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelSetReport_Parameter_ValueResult.Text = "Parameter Successfully Updated."
        Else
            LabelSetReport_Parameter_ValueResult.Text = ErrorString
        End If
    End Sub

C#

	          private void ButtonSetReport_Parameter_Value_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetReport_Parameter_Value(TextBoxParameter.Text, TextBoxValueToSet.Text, TextBoxReportGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelSetReport_Parameter_ValueResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelSetReport_Parameter_ValueResult.Text = "Parameter Successfully Updated.";
                     }
                     else
                     {
                           LabelSetReport_Parameter_ValueResult.Text = ErrorString;
                     }
              }
 

SaveReportConfiguration

  • The SaveReportConfiguration Subroutine saves the current Report 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 ButtonSaveReportConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSaveReportConfiguration.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ErrorString As String = ""
        ModuleNetworkNode.OPCSystemsComponent1.SaveReportConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString <> "Success" Then
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

	      private void ButtonSaveReportConfiguration_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     string ErrorString = "";
                     ModuleNetworkNode.OPCSystemsComponent1.SaveReportConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString != "Success")
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }

LoadReportConfiguration

  • The LoadReportConfiguration Subroutine saves the current Report 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 ButtonLoadReportConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoadReportConfiguration.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ErrorString As String = ""
        ModuleNetworkNode.OPCSystemsComponent1.LoadReportConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString <> "Success" Then
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

	      private void ButtonLoadReportConfiguration_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     string ErrorString = "";
                     ModuleNetworkNode.OPCSystemsComponent1.LoadReportConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString != "Success")
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }