2 Replies Latest reply on Jul 21, 2010 10:16 AM by hanyong

    Startup Processbook with Parameters ?

    mbaldig

      Hello,

       

      is it possible to startup the Proccessbook with Parameters ?

       

      I have the timespace und the tags in a exteral programm and now i want to startup the Processbook with these values out of the

       

      external programm.

       

      Has anybody a solution for me, please ?

       

      Legoracer

        • Re: Startup Processbook with Parameters ?
          Ahmad Fattahi

          It would depend on what exactly you mean by "parameters". Some more general parameters are controlled via the Processbook configuration file called procbook.ini. You can edit this (text) file right before starting up processbook if that's what you desire. For all the details on what can be done via procbook.ini see the corresponding section in Processbook user manual.

           

           

           

          If you need to do more than what procbook.ini allows you to do, you can use the start up display in your PB. The first display that opens after PB comes up is controlled again via procbook.ini. Right after the display opens the VBA method Display_Open() is called inside the display. You can include whatever VBA/PI-SDK code you want to parametrize your display.

            • Re: Startup Processbook with Parameters ?
              hanyong

              Hi Michael,

               

              There is no quick option for you to pass parameters like start time, end time or tags when starting up ProcessBook. I am guessing you want something like passing in parameters to procbook.exe when running from command prompt.

               

              If you have PI Webparts, I think you can make use of the querystring and adhoc trend feature to do this instead.

               

              Taking a different perspective from what Ahmad has suggested. Assuming you want to startup ProcessBook from your program (since you are passing parameters from there), I think an option would be to use PBObjLib.dll and PBSymLib.dll to programmatically start ProcessBook and configure display to show the information. Again assuming, you want to display the information as a trend, we want to configure the trend in the display.

               

              Since you didn't mention what language you are using, here's a sample in C#:

              string tagname = @"\\<servername>\<tagname>";
              string starttime = "*-2h";
              string endtime = "*";

              // startup ProcessBook
              PBObjLib.Application oPB = new PBObjLib.Application();
              // open an existing display based on given filepath
              PBObjLib.Display disp = oPB.Displays.Open(<pdi filepath>, true);

              // get the 1st symbol from the display
              PBObjLib.Symbol sym = disp.Symbols.Item(1);

              // Checking if the symbol is a trend
              if (sym.Type.Equals((int)PBObjLib.pbSYMBOLTYPE.pbSymbolTrend))
              {
                  PBSymLib.Trend t = (PBSymLib.Trend)sym;
                  // add a trace for the tag
                  t.AddTrace(tagname);
                  // set start and end time
                  bool success = t.SetStartAndEndTime(starttime, endtime);
              }

               

              Hope this helps