8 Replies Latest reply on Jul 15, 2013 2:44 PM by dhollebeek

    Migrating Element Relative Displays

    vwitzel

      Hi all,

       

      Could you confirm if it is possible to change the AF server that an element relative display points to, and if so, how this is best accomplished?

       

      Thanks,

       

      -Vincent

        • Re: Migrating Element Relative Displays
          hanyong

          Hi Vincent,

           

          There are ways to do it. The more important part of the question should be how easily can this be achieved. We have customer who have requested to have a tool that will help customers to migrate displays with Element Relative Display (ERD) references to point to another AF Server, but I think this is still a pending request.

           

          You can choose to manually update the references, but usually this takes a lot of manual work, especially if you have a lot of server to handle.

           

          One more efficient way to do this in bulk is to update it programmatically using ProcessBook VBA, something like:

           

           

           
          Sub MigrateERDPaths()
              ' get ERD context handler
              Dim ctxt As ContextHandler
              Set ctxt = ThisDisplay.ContextHandlers("E")
              
              ' get the list of element paths from ERD of the current display
              Dim contexts As PBNamedValues
              Set contexts = ctxt.ContextData(ThisDisplay)
              
              ' loop through the contexts (paths) and replace old server with the new server
              Dim i As Integer
              Dim path As String
              For i = 1 To contexts.Count
                  path = contexts(i).Value
                  ' note that this string replace function is case sensitive
                  path = Replace(path, "HANYONGE6230", "DEVPID6307")
                  contexts(i).Value = path
              Next
              
              ' update the element paths in ERD of the current display
              ctxt.ContextData(ThisDisplay) = contexts
              
          End Sub
          

           

           

          The above code snippet assumes that we are updating the ERD path for the current displays only, but you can modify the subroutine to take in a display object and the strings of the old server and new server name so that you can add on code to open a list of displays and calling the subroutine to do the update for every displays

           

          Hope this helps

            • Re: Migrating Element Relative Displays
              vwitzel

              Hi Han,

               

              This seems to be exactly what I am looking for, thanks :)!

               

              To test it out, I created an ERD with a value object, a trend, and a bar graph. The value object simply shows the full element path, since I do not know of any other way to be able to tell which AF server the elements / display objects are pointing to (please let me know if there is a better way). I then ran the code you provided (having replaced the server names with my own). Afterwards, the elements shown in the "Elements of Interest" have an "*" and a checkmark next to their name (see first screenshot below). Similar to PSE, I assumed this means they had changes to check in, but I did not know how to do so. I right-clicked one of them and clicked refresh, at which point it asks me if I want to apply the changes, but when I try to do so I get the error shown in the second screenshot below. Thoughts?

               

              Thanks,

               

              -Vincent

               

              7534.01-ERD-Element-List.png

               

              0412.02-ERD-Refresh-Error.png

                • Re: Migrating Element Relative Displays
                  hanyong

                  Hi Vincent,

                   

                  It would seem like the icon indicates that there are changes to be checked in. Are the same element (with the same path) available on the new server? I've tested it, and if the element doesn't exists in the new server, the same will happen (no error message though).

                   

                  Perhaps the path to the element on the new and old server is different? for example the AF Database name is different?

                   

                  Since the code only changes the AF Server name portion of the path, any other differences in the path to the element are not handled.

                    • Re: Migrating Element Relative Displays
                      dhollebeek

                      Well, it turns out that there aren't enough buttons in the AF controls to really show what is happening.  Any time you see a "Check-In" box in ERD it means that it can't find the element (either because the path is wrong or because the server can't be found or connected to.

                       

                      :D

                      • Re: Migrating Element Relative Displays
                        vwitzel

                        Han,

                         

                        Looks like the database name was the missing puzzle piece. When I included a replace function to adjust the database name as well and re-ran the code, no "*" or checkmarks appeared in the elements of interest list and it just updated everything :). That being said, I now face a different issue. In build mode, when I try to edit one of the display objects (e.g., a trend) and open up the element relative configuration, it gives me an error (see screenshot below). Thoughts?

                         

                        Thanks,

                         

                        -Vincent

                         

                         

                         

                        0880.Capture.PNG

                          • Re: Migrating Element Relative Displays
                            dhollebeek

                            "Database mode" is meant for references to PI tags directly (it pulls the formatting from the PI server.  AF/ERD doesn't have this functionality, so change the format to "General" (or anything else you want) in the format combo box directly below the error message's Help button.

                             

                            :D

                              • Re: Migrating Element Relative Displays
                                vwitzel

                                David,

                                 

                                Changing the "Format" to "General" indeed fixed the problem, but what was/is throwing me for a loop is that prior to executing the VBA code, opening the element relative configuration with"Database" selected as the "Format" worked without issue. Why would it stop working thereafter?

                                 

                                Thanks,

                                 

                                -Vincent

                                  • Re: Migrating Element Relative Displays
                                    dhollebeek

                                    My guess is that the VBA code is not the issue, but that the problem is that once you go into the symbol configuration, the configuration dialog's validation routines won't allow the symbol to be updated to "Database" even though doing that through VBA works.

                                     

                                    Anyways, I would report this to our Tech Support as a bug.

                                     

                                    :D