9 Replies Latest reply on Oct 31, 2011 2:59 PM by andreas

    IDataProvider3

    PDVPlewa
      Hi out there! Years ago I wrote an Add-In (ProcBook) using IDataProvider and IDataProvider2 with VB6. It works fine, but now I want to replace this Add-In by something build with VB.Net. The Add-In has to deliver several traces and I don't see how to do this with IDataProvider3. In my old solution I had to add some fields to a recordset and RubbelDieKatz! everything was ok. The documentation is not very helpful in this case ...
        • Re: IDataProvider3
          dhollebeek

          The IDataProvider3 interface allows a dataset to implement multiple columns.  Each column would return it's own data.  So on a trend you could plot MyDataset.Trace1, MyDataset.Trace2, MyDataset.Trace3, etc.

            • Re: IDataProvider3
              PDVPlewa

              Hi David! I hope it does - but how? The template uses one column, the PI ProcessBook VBA Language Reference is not really helpful. So I'm lost ...

                • Re: IDataProvider3
                  dhollebeek

                  For instance, GetData would be implemented like this:

                   

                   

                   

                          public void GetData(ref PISDK.PIValues values, DataPoint DataPoint, int UTCStartTime, int UTCEndTime, int MaxValues)
                          {
                              if (DataPoint != null)
                              {
                                  if (String.Compare(DataPoint.ColumnName, "pi", true))
                                  {
                                      PITime endpt = new PITime();
                                      NamedValues nvs = new NamedValues();
                  
                                      values.ReadOnly = false;
                                      endpt.UTCSeconds = UTCEndTime;
                                      values.Add(endpt, "3.14159", nvs);
                                  }
                                  else if (String.Compare(DataPoint.ColumnName, "lifetheuniverseandeverything", true))
                                  {
                                      PITime endpt = new PITime();
                                      NamedValues nvs = new NamedValues();
                  
                                      values.ReadOnly = false;
                                      endpt.UTCSeconds = UTCEndTime;
                                      values.Add(endpt, "42", nvs);
                                  }
                              }
                          }
                  

                   

                    • Re: IDataProvider3
                      PDVPlewa

                      This is the easy part, I understood it in the template. I Think there is something else to be done, in Initialize (TheDataset.columns.add("xyz") ?) or ShowColumnConfiguration or else.

                       

                      Where do I tell him that there are three DataPoints?

                        • Re: IDataProvider3
                          dhollebeek

                          // provide validation ... this should be all you need if you are happy with manually typing "MyDataSet.pi"
                          public bool IsColumnValid(DataPoint DataPoint)
                          {
                              if (DataPoint == null) return false;
                          
                              if (String.Compare(DataPoint.ColumnName, "pi", true) == 0)
                                  return true;
                              if (String.Compare(DataPoint.ColumnName, "lifetheuniverseandeverything", true) == 0)
                                  return true;
                              else
                                  return false;
                          }
                          
                          // tell PB we have a column configuration dialog
                          public bool HasColumnConfiguration()
                          {
                              return true;
                          }
                          
                          // the GUI - Columns is an IN\OUT variable.  You will be passed the column(s) that are currently on the symbol
                          // more than one for a trend, etc.  You may modify this list based on the user's choices and return the new
                          // column(s)
                          public bool ShowColumnConfiguration(ref Columns Columns, DataPoint DataPoint)
                          {
                              MyColumnDialog = new MyColumnDialog();
                              myDialog.ShowDialog(ref Columns);
                          }
                          
                          // tell PB we have a configuration dialog
                          public bool HasConfiguration()
                          {
                              return true;
                          }
                          
                          // provide DataSet wide configuration (polling rate, etc).
                          public bool ShowConfiguration()
                          {
                              MyConfigDialog myConfigDialog = new MyConfigDialog();
                              myConfigDialog.ShowDialog();
                              pollingRate = myConfigDialog.pollingRate;
                          }