Open VI reference from a static reference

Hello guys,
To open VIs dynamically, instead of hardcoding the VI name in a string constant, I do this as shown below to keep a dependency to my VI, so if someone ever delete the VI from the project, move it, rename it, it will create a broken wire somewhere so we'll be able to fix it faster.
However, don't you think it's a bit weird to have the reference to the VI already, but we need to open a new reference, is there a way to get rid of the property node to get the VI path? Is the static VI reference should be closed after the other reference is opened?
Would it make sense to be able to right clic the static reference and specify the option to open a call and forget reference?
Is there a better practice?
Cheers,
Solved!
Go to Solution.

From the LabVIEW help:
vi path accepts a string containing the name of the VI that you want to reference or a path to the VI that you want to reference. If you wire a name string, the string must match the full delimited name of a VI in memory on that target. If you wire a path, LabVIEW searches for a VI in memory that you previously loaded from that path on the same target. If a matching VI is not found in memory, LabVIEW then tries to load the VI from that file on disk. An error occurs if LabVIEW cannot find the file or if the file conflicts with another VI in memory.
So, basically, if you use the string, you load the VI in memory and get an error if not found.  If you use path, it will still use the VI in memory at that path, or attempt to load it.  In your case, it won't make much difference.  I typically use VI Name myself since I know it is in memory.

Similar Messages

  • Returning VI reference from control object reference

    Dear All
    I was wondering if there is anything that acts like inverse of "To more specific class" ? I mean it returns the VI reference from a reference to one of its control object? I think it is like moving upward in the hierarchy!!
    Is there any way to implement that?
    Best ragards
    Afshin
    Solved!
    Go to Solution.

    The property OWNER allows you to climb up the tree.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to invoke a non-static member from a static reference?

    Hello JDC
    My program consist of several classes. I find it more readable,logic and useful to declare all the methods in all the classes �static� and get access by Class.member().
    The problem showed up when I must use a java biuld-in method( as Component.remove ) within my static method , then I receive compile error.
    The first alternative is to create the class instance inside the static my static method , the second is to use interface which declare its member as static final. The two ways doesn�t fit to my needs , do anyone know another way?
    Thanks in advance
    Shay

    Hi
    im sorry but im not sure what you mean by "OO desgin". i'll appreciate if you'll link me some sources about this , its sound very interesting .
    It may be that you are moving to Java from COBOL or >FOTRAN or something and you are not comfortable with >OO philosophy
    For example, you can never have two instances of >the same class have different properties. What's the >point of having classes at all if you are going to do it >this way? Java is my first language , you sound very unhappy about the way i ignore the OOP , i think you right in some terms but i need to exam my thinking again and think how can i implements the same ideas in a form of OOP. whenever all those information will come i'll be able to response.
    thanks for your reply
    Shay Gaghe

  • Unload class (to free static references)?

    My problem: apache fop has a bug that it has a static Map field in a class that increases constantly. Is it possible to "unload" this class to ensure freeing up the references from this static field? And subsequent calls would reload the class when needed?

    Those streams often are created within a method
    and there's no reference (variable) to it outside
    the method (e.g. in the class or super class)?Not sure that reflection will provide you with a work-around for this; although, you could write your own classloader to load JFreeChart, and have it provide your own implementation of ImageInputStream which retains references to un-closed streams so they can be killed off later.
    We're definitely on the way to the land of ick with this sort of hack, though... I think maintaining your own fork of the source code and keeping it in sync with the main project might actually turn out to be easier. That or beating the dev's around the head to get your fixes accepted.
    Dave.

  • Opening a VI Reference from an Application

    I have a VI that calls "Open VI Reference".
    When I'm developing, its not a problem to generate the path, I just point at the path where the VI is located.
    When I build an application, what the heck is the path to the VI?

    LabVIEW can't figure magicallly which VIs you'll call dynamically to include them in the application. That is why you have to add them yourself as "Dynamic VI" in the application builder. It is a one time procedure and may be tedious at most but not painful...
    When you add a VI as Dynamic VI in the AB, the VI and its subVIs are included in the application internal LLB so you do not have to specify the subVIs in the list.
    Labviewguru suggested to include the dynamic VIs on the diagram of a loader VI (set as Dynamic VI in the AB). It is true that all subVIs will be automatically included but you will find the procedure as tedious as selecting them in the AB.
    About the Dynamic VI path in a built application, the good news is that you don't have to care
    at all. When opening a VI reference from a VI path, the server first looks in the application internal LLB (where are stored dynamic VIs) to search for a VI having the same name. If one is found, the actual path is ignored and the internal VI is opened. Thus you can leave the same path you used in LabVIEW development to build an application calling Dynamic VIs.
    Including a LLB as support file won't have any effect on the application. The LLB will simply be copied as is in the destination directory so unless you build dynamic VI paths to this exact location, the VIs won't be found.
    Error 7 means that the VI specified in the path was not found neither in memory, in the internal LLB nor at the actual path. Unless I'm mistaken it also occurs when you attempt to open the front panel of a VI which FP hasn't been saved. By default the AB do not save the FP of dynamic VIs, you have to change this setting manually when required.
    LabVIEW, C'est LabVIEW

  • Cannot reference from static content

    Ok, so I was working on wrapping the main program and the classes together and I come up with that error...TopSort.java:40: non-static method addVertex(java.lang.String) cannot be referenced from a static context. I know why I am getting the error, I am just not sure what to do about it. When I first wrote the main, I was literally adding in the newVertexs, doing it like this...
    Graph theGraph = new Graph();
    theGraph.addVertex("A"); // 0
    theGraph.addVertex("B"); // 1
    and that all worked great. Now I am adding in the text file and have to read the data from the file so I am doing it like this
    String toke1 = toke.nextToken();
    if (toke1.equals("vertex"))
         newVertex = toke.nextToken();
         Graph.addVertex(newVertex);
    but it throws the nonstatic error. How on earth do I go about modifying the class/main in order to circumvent that error?
    Main -
    [import java.io.*;
    import java.util.*;
    public class TopSort
    public static void main (String args[])
         File sourceFile = new File(args[0]); // access the file
            if (sourceFile.exists() == false)                                          
              System.err.println("Oops: " + sourceFile + ": No such file");
              System.exit(1);
            System.out.println(args[0] + " is the name of the file you chose");
            Graph theGraph = new Graph();
            String newVertex, startEdge, endEdge;
            try //open the file, read the file into a string and then into the list
                 FileReader fr = new FileReader(sourceFile);
                 BufferedReader br = new BufferedReader(fr);
              String input;
              while ((input = br.readLine()) != null)
                 StringTokenizer toke = new StringTokenizer(input);
                 while (toke.hasMoreTokens())
                           String toke1 = toke.nextToken();
                           if (toke1.equals("vertex"))
                           newVertex = toke.nextToken();
                           Graph.addVertex(newVertex);
                           else if (toke1.equals("edge"))
                           startEdge = toke.nextToken();
                           endEdge = toke.nextToken();
                           System.out.println(startEdge + endEdge);
                   }//close inner while
              }//close outer while
              br.close();
         }//close try
         catch (IOException e)
            System.out.println("Whoops, there's a mistake somewhere.");
    }Class
    class Vertex
       public String label;        // label (e.g. 'A')
       public Vertex(String newVertex)   // constructor
          { label = newVertex; }
       }  // end class Vertex
    class Graph
       private final int MAX_VERTS = 20;
       private Vertex vertexList[]; // list of vertices
       private int adjMat[][];      // adjacency matrix
       private int nVerts;          // current number of vertices
       private String sortedArray[];
       public Graph()               // constructor
          vertexList = new Vertex[MAX_VERTS];
                                              // adjacency matrix
          adjMat = new int[MAX_VERTS][MAX_VERTS];
          nVerts = 0;
          for(int j=0; j<MAX_VERTS; j++)      // set adjacency
             for(int k=0; k<MAX_VERTS; k++)   //    matrix to 0
                adjMat[j][k] = 0;
          sortedArray = new String[MAX_VERTS];  // sorted vert labels
          }  // end constructor
       public void addVertex(String newVertex)
          vertexList[nVerts++] = new Vertex(newVertex);
       public void addEdge(int start, int end)
          adjMat[start][end] = 1;
       public void displayVertex(int v)
          System.out.print(vertexList[v].label);
       public void topo()  // toplogical sort
          int orig_nVerts = nVerts;  // remember how many verts
          while(nVerts > 0)  // while vertices remain,
             // get a vertex with no successors, or -1
             int currentVertex = noSuccessors();
             if(currentVertex == -1)       // must be a cycle
                System.out.println("ERROR: Graph has cycles");
                return;
             // insert vertex label in sorted array (start at end)
             sortedArray[nVerts-1] = vertexList[currentVertex].label;
             deleteVertex(currentVertex);  // delete vertex
             }  // end while
          // vertices all gone; display sortedArray
          System.out.print("Topologically sorted order: \n ");
          for(int j=0; j<orig_nVerts; j++)
             System.out.print( sortedArray[j]);
          System.out.println("");
          }  // end topo
       public int noSuccessors()  // returns vert with no successors
          {                       // (or -1 if no such verts)
          boolean isEdge;  // edge from row to column in adjMat
          for(int row=0; row<nVerts; row++)  // for each vertex,
             isEdge = false;                 // check edges
             for(int col=0; col<nVerts; col++)
                if( adjMat[row][col] > 0 )   // if edge to
                   {                         // another,
                   isEdge = true;
                   break;                    // this vertex
                   }                         //    has a successor
                }                            //    try another
             if( !isEdge )                   // if no edges,
                return row;                  //    has no successors
          return -1;                         // no such vertex
          }  // end noSuccessors()
       public void deleteVertex(int delVert)
          if(delVert != nVerts-1)      // if not last vertex,
             {                         // delete from vertexList
             for(int j=delVert; j<nVerts-1; j++)
                vertexList[j] = vertexList[j+1];
                                       // delete row from adjMat
             for(int row=delVert; row<nVerts-1; row++)
                moveRowUp(row, nVerts);
                                       // delete col from adjMat
             for(int col=delVert; col<nVerts-1; col++)
                moveColLeft(col, nVerts-1);
          nVerts--;                    // one less vertex
          }  // end deleteVertex
       private void moveRowUp(int row, int length)
          for(int col=0; col<length; col++)
             adjMat[row][col] = adjMat[row+1][col];
       private void moveColLeft(int col, int length)
          for(int row=0; row<length; row++)
             adjMat[row][col] = adjMat[row][col+1];
       }  // end class Graph
    ////////////////////////////////////////////////////////////////

    I don't think I quite understand what you mean by
    that, would you elucidate? Sorry, serious brain
    fry...Sure; your addVertex() method isn't declared static. This means that you cannot call it as a class method, which was what you were doing when you wrote "Graph.addVertex()". Class members (as defined by the keyword static) refer to methods and variables that pertain to the overall class as a whole, as opposed to instance members that pertain to individual (instantiated) objects of that class.
    For example, look at the java.lang.Integer class. It has static methods like parseInt() and instance methods like intValue(). The instance method (intValue()) requires that you have instantiated an Integer object from which to get the value. You can't just call Integer.intValue(), because there's no value for the overall Integer class!
    Likewise, it doesn't make sense to require you to have an actual Integer object to parse a String to an int value. An actual Integer object wouldn't have anything to do with the process. Thus the parseInt() method is static, meaning you can call Integer.parseInt() to get the value of an int from a String.
    Hope this helps!
    &#167;

  • How do I use a static reference to keep a VI in memory but then call it in parallel?

    Hello all,
    I have a MainVI and I want to call from it a SubVI in parallel so that I can have both windows open and responsive at the same time.  The SubVI may be closed and reopened any number of times, but only one in existance at a time.  I know how to do this using Open VI Reference, providing a relative path to my SubVI, checking its state to see if its already running, and if so bring the window to the front (using Front Panel: Open method with True/Standard inputs), and if not run it using the Invoke:Run method (and optionally opening its front panel programmatically).  This method was working fine.
    Now I have added functional global variables in my SubVI, and I want to keep them in memory inbetween opening the SubVI window.  I can do this by putting a copy of the functional global in my MainVI, even though I don't use it there for anything.  This works fine.
    By accident, I have come across a reference to a Static VI Reference, which sounded like a vast improvement to my methodology, for the following reasons:
    1) Keeps SubVI in memory all the time, eliminating the need to put the functional global in MainVI when it is not used there.
    2) Tells LabVIEW to include SubVI when I build my executable, rather than me having to specifically mark it as Always Include in the build specification.
    3) Eliminates the need to keep the path and SubVI name updated in a string constant in my code, in order to use the Open VI Reference.
    However, trying to implement this solution, I have run into the problem that once you put a strictly-typed static VI reference (strict typing is required to keep it in memory) onto the block diagram, that VI is reserved for execution.  That means I cannot run it using the Invoke:Run method.  I haven't tried just putting it on the diagram directly as a subVI because I need it to run in parallel to the MainVI.  I have searched through these forums extensively, and although there are several references to a static VI reference, none of them say explicitly how to actually run the darn thing!  :-P
    I very much appreciate any insight into my problem.  If I have to go back to the old way it will work fine, but I really like the seeming elegance of this solution.  I hope that it is technically feasible and I'm not misunderstanding something.
    Thank you for your help,
    -Joe
    Solved!
    Go to Solution.

    > If I understand you correctly, they can only really be used for re-entrant VIs. 
    No, a static VI reference can be used anywhere a regular VI reference (property nodes etc.) The reason for the hoop-jumping above is that we are really opening a reference to a CLONE (copy) of the VI identified by the static VI reference.
    > Okay, I tried it, and got the code shown below... Any idea why it isn't working?
    The VI you want to clone can't be on the diagram as a "normal" subVI. When you run your application you should be able to open that VI and see it just sitting there with a run arrow waiting to run. See attached example (LV2009SP1).
    "share clones" vs "preallocate" has to do with whether you want each clone to preserve state (such as in an uninitialized shift register). Generally you use share clones. Occasionally it is useful to have multiple copies on a diagram that each remember some data, like "timestamp of last execution" in a shift register.
    Other VIs in your spawned process don't have to be re-entrant unless they are functions that "wait forever". All the built-in G functions are re-entrant. It's pretty common to use a queue to feed data to a spawned process.
    Spawning a process is more difficult than just running two parallel loops. It's useful because once you've made 1 copy, you can make 50. If you just want to do two things (vs n things) at once, I would just use two loops.
    Attachments:
    SpawnProcess.zip ‏20 KB

  • How do you make a static reference to a method?  I've included code.

    I'm sorry but this is a cross post. This should be here but it is also in the 100% pure Java forum. It won't happen again.
    Now...
    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{   
        static String sString = "TESTING";   
        public int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;      
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );   
    }Again, I apologize for the cross post.

    hi,
    this seems to be pretty easy, isn't it?
    Oh c'mon! You try to invoke a non-static method from within a static method. Solution: Create a specific instance of class testClass:
    testClass test=new testClass();
    test.add(3,4);best regards, Michael

  • How to get caller object reference from a method

    Hi,
    I am working a already existing Java Swing project, now I got a problem, in a method I need to get the caller object reference otherwise, I can't succeed this operation. So please tell me a way how to get the caller object reference from a method. that method would be static or regular method anything will do for me.
    Edited by: navaneeth.j on Jan 29, 2010 11:20 PM

    navaneeth.j wrote:
    Actually my doubt is, I have a method "addition" method, which is using by many classes so my requirement is in the addition method I want to write a code snippet which will identify and get the the caller object. Actually I tried Reflection.getcallerclass but there I am getting "CLASS" object not the actual object reference, but I want object reference.
    Actually we have a huge project which is writen plain JAVA, so in this project the authors written the Database connection package for single database transaction. so now we are using this project source code for JSF application in this web application the DB package has serve based on the dynamic db connection parameters, so if we want to change this package fully means need to solve the dependency problem in hundreds of classes, so my point is if I can access the caller object in the DB package when ever it gets called by any class from any where of the project. So actually I liked Reflection.getcallerclass, the way of implementation perfectly works for me but it is not giving caller object reference, if something gives the caller object then I can get the DB connection parameters then there is no need to pass the parameters in the hierarchy.You can add a parameter (of type Object) to your addition() method
    and everywhere you call the addition() method also pass this (which from the POW of the addition() method will be a reference to the calling class instance).
    There may be alternative solutions
    but none that require less effort.

  • STATIC REFERENCE

    THE CODE IS ATTACHED. I NEED TO SOLVE THE ERROS.
    THIS IS THE ERRORS AFTER COMPILE
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:47: Can't make static reference to method void setLayout(java.awt.LayoutManager) in class java.awt.Container.
                        setLayout(new FlowLayout());
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:48: Can't make static reference to method void setBackground(java.awt.Color) in class java.awt.Component.
                        setBackground(Color.green);
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:53: Can't make static reference to method java.awt.Component add(java.awt.Component) in class java.awt.Container.
                        add(l);
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:58: Can't make static reference to method java.awt.Component add(java.awt.Component) in class java.awt.Container.
                        add(name);
                        ^
    C:\My Documents\Java\Assignment\Assign3\PwdClient.java:61: Can't make a static reference to nonstatic variable tf_name in class PwdClient.
                        tf_name = new TextField(20);
                        ^
    5 errors
    //HERE IS THE CODE
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    class PwdClient extends Frame
         private TextField tf_name;
         private TextField tf_password;
         private String input_str_name;
         private String input_str_password;
         private String str_to_pass;
         //private String str;
         //private String str_name;
         //private String str_password;
         //private Button button1;
         private final static int buffsize = 512;
         public static void main(String args[])
              try
                        String server = args[0];
                        int port = Integer.parseInt(args[1]);
                        //create socket
                        Socket s = new Socket(server, port);
                        //readresult from server
                        InputStream is = s.getInputStream();
                        DataInputStream dis = new DataInputStream(is);
                        OutputStream os = s.getOutputStream();
                        DataOutputStream dos = new DataOutputStream(os);
                        InputStreamReader isr = new InputStreamReader(System.in);
                        BufferedReader br = new BufferedReader(isr);
                        //Frame frm = new Frame( "Client Server" );
                        setLayout(new FlowLayout());
                        setBackground(Color.green);
                        String str = "Enter Name and Password:";
                        Label l= new Label( str, Label.CENTER);
                        l.setBackground(Color.red);
                        add(l);
                        String str_name = "Name:";
                        Label name = new Label( str_name, Label.CENTER);
                        name.setBackground(Color.red);
                        add(name);
                        //Name textfield User input for name
                        tf_name = new TextField(20);
                        add(tf_name);
                        String str_password = "Password:";
                        Label password = new Label( str_password, Label.CENTER);
                        password.setBackground(Color.red);
                        add(password);
                        //Password Textfield (user input for password)
                        tf_password = new TextField(20);
                        tf_password.setEchoChar('*');
                        add(tf_password);
                        Button Button1 = new Button("Submit");
                        add(Button1);
                        Button1.addActionListener( new ActionListener()
                             public void actionPerformed(ActionEvent ae)
                                  input_str_name = tf_name.getText();
                                  tf_name.setText(new String(""));
                                  input_str_password = tf_password.getText();
                                  tf_password.setText(new String(""));
                                  str_to_pass = input_str_name+"/"+input_str_password;
                                  dos.writeBytes(str_to_pass);
                                  String received_from_server = brr.readLine();
                                  l.setText(received_from_server, Label.CENTER);
                        frm.setSize( 300, 200 );
                        frm.show();
                        frm.addWindowListener( new WindowAdapter()
                             public void windowClosing(WindowEvent e)
                             { System.exit(0);}
              }//closes the try
              catch(Exception e){}

    Put the code you have in static main in a constructor, or make an instance of PwdClient in main that you can call those methods on. You can't call non-static methods directly from a static method (main). You need to instantiate the class.
    public class PwdClient extends JFrame {
      public PwdClient() {
        // the code from your main method
      public static void main(String[] args) {
        new PwdClient(); // makes a new instance of PwdClient
    }

  • Static reference; how am I instantiating this incorrectly?

    Hi, all:
    I'm getting a static reference error, but I don't know how to fix it. I'm trying to generate a list of objects, and I can't tell where the problem is located. I've chopped all the irrelevant stuff out of this class so you can see what's going on:
    public class VonNeumannGridNet {
         public int nCols = -1;
         public int nNodes;
         public int nRows = -1;
         public int radius = -1;
         public ArrayList <Node> nodeList;
         public Class <Node> nodeClass;
         public Class <Edge> edgeClass;
         public VonNeumannGridNet ( Class<Node> node, Class <Edge> edge, int cols, int rows, int connectRadius) {
              nodeClass = node;
              edgeClass = edge;
              nCols = cols;
              nRows = rows;
              nNodes = nCols * nRows;
              radius = connectRadius;
         public ArrayList<Node> makeVonNeumannGridNet(Class<Node> node, Class<Edge> edge,
                   int cols, int rows, int connectRadius) throws IllegalAccessException, InstantiationException     {
              return nodeList;
         public static List <Node> makeVonNeumannGridNet(int cols, int rows, int connectRadius,
                   double rewireProb, Class <Node> node, Class <Edge> edge) {
              ArrayList <Node> list = makeVonNeumannGridNet(node, edge, cols, rows, connectRadius); //ERROR HERE
              ArrayList <Node> network = new ArrayList <Node> (NetUtilities.randomRewireSymmetric(list, rewireProb));
              return network;
    public Class <Node> getNodeClass() {     return nodeClass;}
    public void setNodeClass(Class <Node> node)     {nodeClass = node;}
    public Class <Edge> getEdgeClass()     { return edgeClass;}
    public void setEdgeClass(Class <Edge> edge) {edgeClass = edge;}
    }The error happens when I try to "makeVonNeumannGridNet"; how is that a static reference?

    Geesh what a worthless discussion.
    After all, the cause of your problem is that you're trying to access an instance method from within a static (non-instance!) method. The possible solutions might be obvious:
    1) make both methods non-static.
    2) make both methods static.
    3) make the calling method non-static and make the method-to-be-called static.
    4) instantiate the class having the instance method and invoke that method using the reference.
    Read a good Java book/tutorial and learn about static vs. non-static. Don't use them randomly, but use them when the design and behaviour require.

  • Static references to images

    Adobe RoboHelp 7 creates static references for images I
    import into my webhelp pages. Aside from manually converting the
    references to relative references, how can I get RH7 to correctly
    reference my images?

    Hi there
    I'm not sure what's up with your version of RoboHelp 7. Maybe
    it's how you are inserting images? I've never known RoboHelp to
    ever really create absolute references to images. It has always
    been quite adept at creating relative references.
    Are you absolutely certain absolute references are being
    created? I ask, because when you initially select an image by
    browsing to it, the reference may look like an absolute reference
    until you click OK to commit the information to the page. If you
    examine the properties later, the image has been copied to the
    project and bears a relative path.
    Cheers... Rick

  • Obtaining activex reference from activex container

    I have a VI with an embedded MediaPlayer activex object inside an activex container.  Additionally, I have a seperately run VI which I want to be able to control the MediaPlayer obejct in the first VI.  These VIs are opened seperately, so I cannot pass information directly from one to another (i.e., I can't directly pass the MediaPlayer activex reference to the second VI directly).  Therefore, the second VI obtains a reference to the activex container object by searching the first VI's controls and filtering by label.  I can typecast the control reference to the level of activex container, but from there I have no way of obtaining a reference to the object embedded in it.  Is there are way to do this?  The "To more specific class" function does not accept activex references for typecasting, and the automation open does not accept activex container references.  I've searched through the forums, and while there is plenty on activex references and containers, there doesn't seem to be anything that addresses my issue.

    I'm not 100% about whether this will work, but give it a try. Once you have a reference to the container, use the 'Value' property. This will give you a variant. From here you can use Variant to Data, connect a MediaPlayer constant reference to the type input and you should get the correct reference out.
    Also, you could simply get a reference to the VI with the ActiveX control and use the method 'Control Value: Get[Variant]' to get the value of the control instead of getting a list of all the controls and searching for the one you want.

  • Create static references array

    Hello,
    i have done a labview program which controls six different test machines.
    the different tests are VIs which are kept by the main program in an array of static references. this way i have to write the vi only once. afterwards i create six different references of the same vi, each of them managing one test machine.
    everything is working fine. the only drawback I have found, is how to create the six references of each VI.
    the first thing I tried, was to locate the static reference function inside a loop. I enabled indexing, and i expected to obtain an array of six different references of the same vi. unfortunately this is not working: i obtain an array with six times the same reference.
    to fix this, i located the static reference function inside a switch with six cases. all of this, inside the same loop. i have to use the static reference function six times, one for each test machine. this is working, but is more work. everytime a add a new test vi, I have to add the switch with the six cases. it is a lot of copy & paste work, and errors are likely to be done doing this.
    I would like to know if there is any other (and simpler) way of obtaining this array.
    enclosed you find an example showing this: the upper loop creates an array of six references but all of them are the same. the other one, uses a switch-case so that different references are generated.
    thank you in advance
    Attachments:
    static references array.zip ‏11 KB

    I think you missed the point of what I was getting at. If you create a template VI and programmatically open a reference to it 6 times you will get references to 6 independent instances of the template all running in memory. Nothing needs to get saved to disk. If the template changes simply close the 6 old references and open 6 new ones.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Close reference from event data node

    When using an event structure, I often times use
    the Control Reference output in the Event Data Node.  Do I need to
    close these references each time the corresponding event fires?  In
    other words, are the reference created from this node unique each time
    that particular case is called?

    The Event Structure does not create duplicate references to the same object if the event case is called multiple times, so you don't have to worry about having dozens of open references. You can actually verify this by type-casting your control reference to an I32 to see the exact 32 bit value (or just probe the refnum). Firing the event case multiple times produces the same reference.
    You really don't need to worry about closing the reference in this case. In general, LabVIEW will figure out that the control references are no longer valid as soon as the VI goes idle, and it will clean them up. Closing references is good practice if you're going to be opening a large number of references (for instance, getting references to all controls on a large Front Panel), and you don't want them all to stay in memory the whole time.
    Jarrod S.
    National Instruments

Maybe you are looking for

  • Can I use officially unlocked iPhone in different countries?

    I'm moving to Rome with my job for eight months, then on to Chicago for four months, then back to London. I'm trying to find out if I buy an unlocked Pay as You Go iPhone in one of the various EU countries selling manufacturer unlocked units (France,

  • How to change exchange rate in VA02

    Dear Experts We have sales order which is having around 5 line item and in that 1st line item alone has been invoiced in January and later items still not invoiced In the month of February, the invoice for 1st line item has been cancelled , so to avo

  • IPhone 4 orange UK in Poland.

    Hi! In UK i used iPhone 4 with Orange UK simlock, now i'm in Poland and i can't use my iphone. How i can unlocked my iphone in Poland?

  • Monitoring memory used by Oracle instance

    Hi, How can i check how much memory is being used and allocated by an Oracle instace? Is there any way to do? Ashish

  • Illustrator CS5 perspective questions

    I recently upgraded to CS5 and was playing with the perspective tools and a couple of questions came up. Is it possible to change the perspective and have objects already created update to the new persp? Also, I noticed strokes don't follow the persp