4 Replies Latest reply on Jun 13, 2012 8:01 AM by andreas

    Display / Add Datasets

    sovain

      Hi All,

       

      I am really stuck in finding a solution for the next issue.

       

      In .NET Application I need to trend couple of tags as well as some ODBC Data.

       

      In a result, I want to make a specific SQL query and add the (Time Value ) result to Trend.

       

      If you look at the code, I add a Dataset with the Dataprovider: pI_dataset,  that is pre-defined on my form with QueryTableAdapter; test query is ok.

       

      But when I lunch it sinusoid-tag is trending well,  "EOH_POSITIONS_CURRENT" - say "Invalid Data".

       

      Am I doing something wrong?

       

      Is there any other way to retrieve real PI Data without using ODBC and connect it to trend ?

       

      Thank you

       

      Oleg

       
      ....
      lifing_Define_hourlyeoh_Trend = (PBSymLib.Trend)lifing_Trend_hourlyeoh_Display.Symbols.Add(PBObjLib.pbSYMBOLTYPE.pbSymbolTrend);
      
      //----add Dataset - here is problem
      lifing_Trend_hourlyeoh_Display.Datasets.Add("EOH_POSITIONS_CURRENT", pI_dataset, true, 1, true, 1);
      
      
      
      lifing_Define_hourlyeoh_Trend.AddTrace("sinusoid");
      //----try to add DS - data
       lifing_Define_hourlyeoh_Trend.AddTrace("EOH_POSITIONS_CURRENT.Value");
      

       

        • Re: Display / Add Datasets
          andreas

          Oleg - I am not sure that I understand your question.

           

          Your code creates a ODBC dataset, so you would use "null" instead of pI_dataset. I don't have a c# example at hand, but here is the VBA code:

           
              Dim myds As PBObjLib.ODBCDataset
              Set myds = Me.Datasets.Add("MyODBCDataSet", Nothing, False, 1, True, pbDatasetODBC)
              Set myds = Me.Datasets.GetDataset("MyODBCDataSet")
              myds.DataSourceName = "MyTest"
              myds.Query = "SELECT * FROM [Andreas]..[TestData]"
              Me.Datasets.SetDataset myds