2 Replies Latest reply on Jul 29, 2015 12:49 PM by daviessj

    How do you get "isXTag" from an existing XY Plot in Processbook using C

    daviessj

      I am building a custom Windows Forms Application using C# to automate the process of changing tags from an old PI server to a new one (changing tag names and the server name) and have run into a problem with XY Plots.  I need to get and retain the "isXTag" property for each tag assigned to an existing XY Plot before making any changes but can't seem to find how to do so.  The Processbook VBA Programming Guide seems to imply that there is an "Index" property on the "XYTags" collection within an XYPlot to access the information for a particular tag, but it does not seem to exist for the XYPLot.dll in C#.

       

      My current code allows me to get the XYPlot object and its Definition (see code below) , but I can't find a way to find if a particular tag is the "X" tag.

       

      Does anyone have any experience with this and can you help me find a way to access this information please?

       

       

      XYPlot sXYPlot = (XYPlot.XYPlot)selectedSym;

       

      XYDefinition sXYPlotDefinition = sXYPlot.GetDefinition();

       

        • Re: How do you get "isXTag" from an existing XY Plot in Processbook using C
          dng

          Hi Steven,

           

          First of all, please make sure the reference to the project is to OSIsoft.XYPlot.dll (in %pihome%\Procbook\PublicAssemblies folder) instead of XYPlot.dll (in %pihome%\Procbook folder). The dlls in the PublicAssemblies folder are designed for external use.

           

          'isXTag' is a property of XYTag. You can get the XYTags Collection from the XYDefinition, then access the XYTag within the XYTags Collection, e.g.

                      XYPlot.XYPlot sXYPlot = (XYPlot.XYPlot)selectedSym;
                      XYDefinition sXYPlotDefinition = sXYPlot.GetDefinition();
                      XYTags sXYTags = sXYPlotDefinition.Tags;
                      foreach (XYTag tag in sXYTags)
                      {
                          if (tag.IsXTag)
                          {
                              //action
                          }
                      }
          

           

          Are you trying to change tag and server names for ProcessBook displays? If so, check out the PI ProcessBook Support Tool to see if it satisfies your requirement. The user guide can be downloaded here.