3 Replies Latest reply on Oct 3, 2009 2:05 PM by spilon

    Automated Batch Search

    formerpigeek

      Hi ,

       

      I want to write a code to get PI Batches based on the user input in different cells in excel.

       

      Basically, I want to fill up the the entries in the window below and get the results back in the sheet programatically.

       

      This is the PI Batch Search Window.

       

       

      Can someone please post a few lines of code as a hint.

       

      Thanks in advance.

        • Re: Automated Batch Search

          Hi Kapil,

           

          I may have misunderstood your question, but I think you're looking for something BatchView already does: when you click in one of the fields that has the button with an underscore at the end (e.g. Batch ID, Product, Recipe, etc.), you can then click right on a cell on the spreadsheet. Clicking on the "underscore button" simply minimizes the window to let you pick a cell more easily - then you click on the underscore button again to restore the window to its original size.

           

          For the the combobox-style fields (All, Active, Any Length, etc.), you need to click on that icon with the right arrow and this will turn the field into a "cell selection" field - this is when you can select a cell on the spreadsheet.

           

          Let me know whether that's what you were looking for or I completely misunderstood you!

            • Re: Automated Batch Search
              formerpigeek

              Hey Steve,

               

              The user is not going to use the PI BatchView window hence the need of some code.

               

              The reason to do this is to interact with the user with a simple interface and set a standard report for everyone.

               

              As an example , the Start Batch Search button below will display the search results.

               

               


              I hope this explains the  problem. Thanks for your reply.

               

               

                • Re: Automated Batch Search

                  ahhhh, that explains why! Just wanted to make sure you knew BatchView supported referring to cells. Programmatically, you would could perform the same search BatchView performs using the following code:

                  Dim batches As PISDK.PIBatchList
                  Dim batch As PISDK.PIBatch

                  Set batches = somePIServer.PIBatchDB.PIBatchSearch(...)   ' with arguments coming from the cells

                  For Each batch In batches
                      ' do something with "batch"
                  Next

                  (don't forget to add a reference to the PI SDK Type Library in your VBA project)

                   

                  Hope this helps!