2 Replies Latest reply on Jan 28, 2013 9:26 PM by Ahmad Fattahi

    Linking PI-SQC Chart and BatchGroup Object in ProcessBook


      I am trying to link the PI-BatchGroup Object "Product" fieled in the runtime PIUnitBatch Search box with the PI-SQC Control "Filter Equation" field on the sample tab.  I think the ComboBox "Change" event would be a good mechanism to do this, but I am not seeing where to rite the value to the SQCSymbol.


      The purpose of this is to allow a user to have a both a batch gruop and SQC chart on a ProcessBook display.  By selecting a differnt product, both ojects would update together,


      Any help with the code would be appreciated.

        • Re: Linking PI-SQC Chart and BatchGroup Object in ProcessBook

          I found the solution in the help files for the SQCSymbol and the BatchGroup.


          I have had a few customers who wanted to make the SQC Chart specific to a discrete value, such as a maximum temperature for each batch, for a specific product.  This simple link will bring them a lot of value.


          Dim SQCobj As SQCSymbol


          Dim sqcDef As SQCSymbolDefinition


          Dim strEquation As String


          Private Sub Display_Open()


          ComboBox1.AddItem ("Digest-A201")


          ComboBox1.AddItem ("Digest-A202")


          ComboBox1.AddItem ("Digest-A203")


          ComboBox1.AddItem ("Digest-A204")


          End Sub


          Private Sub ComboBox1_Change()


          Dim myTrendDef As BatchTrendDef


          Dim myQuery As PIBatchView


          Set SQCobj = ThisDisplay.SQCSymbol1


          Set sqcDef = SQCobj.GetDefinition


          strEquation = sqcDef.FilterEquation


          sqcDef.FilterEquation = " 'PP:Digest1.Prod' =""" & ComboBox1.Value & """"


          SQCobj.SetDefinition sqcDef


          ' Get the query definition from the BatchGroup


          Set myTrendDef = BatchGroup1.Trends(1).GetDefinition


          Set myQuery = myTrendDef.Query


          ' Change the query


          myQuery.ProdTest = ComboBox1.Value


          myTrendDef.Query = myQuery


          ' Set the definition containing the new query back


          Call BatchGroup1.SetDefinition(myTrendDef)


          End Sub