2 Replies Latest reply on Feb 21, 2018 1:40 PM by Rick Davin

    Error getting Summaries2 value to output

    Syncrude

      I am getting the string "System._ComObject" written to the debug output.  Any suggestions to correct the error?  I want to output the named value for any of "Average", Maximum", etc.

       

      Thanks for your help.  Apologies for the text code post, I am not sure how to post where the line numbers, etc. appear.

       

      Thanks for the patience with a newbie.

       

       

      System;


      System.Diagnostics;


      PISDK;


      PISDKCommon;



      class PiFunctions


      // Start and end time


      public string piStartTime;

       

      public string piEndTime;

       

      public string duration;

       

      //PI Tag, value and server


      public string piTag;

       

      public string piValue;

       

      public string piServer;

       

      public int piSummaryMethod;

       

      int i; PISDKCommon.NamedValues nvsSum;

       

      string starttime = "10/26/2009 10:00:00";

       

      string endtime = "10/25/2009 10:00:00";

       

      string interval = "1D";

       

      public PiFunctions(string currentPiServer)

       

      "";

       

      "";

       

      "";

       

      "NONE";

       

      "-1.0";

       

      public string piSummary(string currentPiServer, string currentPIStartTime, string currentPIEndTime, string duration, string piTag, string piSummaryMethod)

       

      new PISDK.PISDK();

       

      string sqlString = "tag=" + "'" + piTag + "'";

       

      // IPIData2 interface and namedValues storage for filtered values result 


      new PISDKCommon.NamedValues();

       

      // summary values 


      // Set method for namedValues 


      //Recorded values


      string.Empty, FilteredViewConstants.fvShowFilteredState, null);

       

      //Get the desires archive value


      object o = "Average"; // piSummaryMethod;


      ref o).Value;

       

      return valsum.ToString();

       

        • Re: Error getting Summaries2 value to output
          gregor

          Hello Anthony,

           

          Dealing with ComObject types can be pretty annoying. This is one out of many reasons to prefer AF SDK upon PI SDK with new .NET development projects.

          Reading through the code you pasted, it doesn't appear to do anything meaningful. Looks as if ~50% have disappeared during copy-paste operation e.g. I am not seeing any 'using' within the using section.

          Have you tried the example Rhys has shared as response to your other question in a command line application?

           

          Please also allow me to repeat my question: What are the reasons to prefer PI SDK upon AF SDK?

          Because this doesn't appear to be a wise choice, we may be able to assist you with some arguments in favor of AF SDK.

            • Re: Error getting Summaries2 value to output
              Rick Davin

              The code show doesn't look like complete code.  It looks quite garbled with lots of stuff missing.

               

              I would expect this:

               

              System;
              

               

              To be:

               

              using System;
              

               

              Anthony, could you post your code again but without truncating portions that would constitute a complete line of code.  We understand if you must obfuscate some server names, etc.