4 Replies Latest reply on Dec 23, 2010 1:53 AM by formerpigeek

    Passing of Variables using ActiveView

    formerpigeek

      Hi,

       

      I have serveral buttons on the screen of my Main.pdi file,  and these buttons open the Stations.pdi file, and pass some parameters to that file through VBA:

       

      Private Sub StationCir1_Click(ByVal lvarX As Long, ByVal lvarY As Long)
       Dim d1 As Display
       Set d1 = Application.Displays.Open(FolderPath & "Stations.pdi", True)      

       

      ' "FolderPath" is the path of the folder that has all the .pdi files. 
       d1.stationNumber = 1 

       

       'If I click on StationCir2, stationNumber would be 2,etc..                                                                                           

       

      End Sub

       

      In my Stations.pdi file, I declared stationNumber as integer and the passing of the variable stationNumber works fine when using ProcessBook. But when I use ActiveView, stationNumber is always zero when a display file is opened in html since the variable is not being passed.

       

      I'm wondering if there is any workaround to this problem.

       

      Thanks a lot.

       

       

       

       

        • Re: Passing of Variables using ActiveView
          Ahmad Fattahi

          John,

           

          How are you referring to the path of the file Stations.pdi? One difference in PI Processbook and PI ActiveView usage might be the paths. Can you confirm that d1 actually gets assigned to the desired pdi file to begin with? Are you able to manipulate anything in the file or on the screen using object d1?

            • Re: Passing of Variables using ActiveView
              formerpigeek

              Hi Ahmad,

               

              I am sure that d1 gets assigned to the desired .pdi file. Here is how I define the path:

               

              PathArray = Split(ThisDisplay.Path, "\")

               

              Length = UBound(PathArray)

               

              PathArray(Length) = ""

               

              FolderPath = Join(PathArray(), "\")

               

              So FolderPath & "Stations.pdi would be my full path to the .pdi file. Everything works fine using this method within Processbook. (I have to assign the stationNumbers to the Stations.pdi file since everything in the Stations.pdi file is element relative, and everything changes according to that stationNumber, including some of the layout for the screen).So I am pretty sure the variable got passed.

               

              And when I use ActiveView, I changed the path to just

               

              Set d1 = Application.Displays.Open("Stations.pdi", True)      Note that I got rid of the "folderpath" in front of the "stations.pdi", since by default, the html opens the .pdi files within the same folder. (But in Processbook I have to specify the path as well as the file name)

               

              So in ActiveView, the Stations.pdi file can be opened no problem, it's just that the StationNumber is not being passed successfully anymore.  

               

              Hope I explained it correctly,

               

              Thanks a lot for your help!

                • Re: Passing of Variables using ActiveView
                  Ahmad Fattahi

                  John, thanks very much for your detailed response. Just for the sake of a quick test, can you include the full path in your ActiveView code to see if that makes any difference. My goal is to rule out the possibility of any path misconfiguration.

                    • Re: Passing of Variables using ActiveView
                      formerpigeek

                      Hi Ahmad, thanks a lot for your reply. Actually I always used the full path before I put everything on the server. So before putting the folder containing all the files to the server, everything was local and I had to use the full path for my program to work, but d1.stationNumber still could not get assigned to the desired .pdi file (but the ProcessBook version did).

                       

                      Thanks again for your response, really appreciate your help.