3 Replies Latest reply on Nov 9, 2012 7:06 PM by dhollebeek

    Getting SPC Chart Time Range

    rdube02

      Hi Everyone,

       

      This seems like it should be ridiculously easy, but I can't seem to figure out how to do it.

       

      I have an SPC chart using the ProcessBook SPC plugin, and the chart auto-calculates start/end times based on the sample settings in the chart. Once the charts are up and displaying, I would like to display the plot range values by showing the max/min date/times from the x-axis.

       

      I can find how to do a "SetPlotTime" on the SPC, and I've even found a "GetPlotTime", which I think might work, but I can't seem to get the syntax of the method right, and there's no PI documentation anywhere that shows an example of how to use that method.

       

      Does anyone have any example of how to use the GetPlotTime method correctly? I'm trying to do this in ProcessBook VBA btw.

       

      Thanks for any insight you can offer.

       

      -Ryan

        • Re: Getting SPC Chart Time Range

          Hi Ryan,

           

          There is a dedicated help file for the SQC chart installed with ProcessBook, "SQCVBA.chm".  It includes documentation for GetPlotTime.

           

          Snippet:

           

          The SQCSymbolDefinition Object GetPlotTime Method returns the currently used values for the Plot Times.

           

          Format

           

          GetPlotTime (ByRef StartType As StartTypeEnum, ByRef vStartTime As Variant, ByRef vEndTime As Variant)

           

          Arguments

           

          StartType

           

          The type of the time scale for this plot. This is an enumerated type. See Notes below for a definition of the StartTypeEnum. Input parameter.

           

          vStartTime

           

          This is the value that specifies together with the StartType the start time to be used for the plot. It is either a number of samples, the name of a tag, or a PI-ProcessBook range represented in a string. Output parameter.

           

          vEndTime

           

          The End Time in PI-ProcessBook time range format. Output parameter.

           

          Errors

           

          PbErrInvalidTypeParameter

           

          The StartType parameter was invalid. It must be a valid StartType Enum value.

            • Re: Getting SPC Chart Time Range
              rdube02

              Thanks Rhys - I did find the documentation that had that in it, but unlike other functions it does not provide an example, and I couldn't manage to figure out how to structure the call so that it actually works. There don't appear to be any examples anywhere in these forums or the tech support site either.

                • Re: Getting SPC Chart Time Range
                  dhollebeek
                  Dim oSQCDef as SQCSymbolDefinition
                  Dim stStartType as StartTimeEnum
                  Dim vStart as Variant
                  Dim vEnd as Variant
                  
                  Set oSQCDef = SQCSymbol1.GetDefinition()
                  
                  stStartType = sqcSamplesBeforeEnd
                  vStart = 20
                  vEnd = "*"
                  oSQCDef.SetPlotTime stStartType, vStart, vEnd
                  
                  oSQCDef.GetPlotTime stStartType, vStart, vEnd