I have 8 global variables and I would like to use the same VI for a specific reading and writing of those files.
The variables are the type "Byte Stream File reference".
How can I create a case structure where I will use a different shift register for each case, using the name of the variables as the name of the cases?
For instance, I have "Text files" and "Results files" as the name of the global variables and I would like to create different cases for each of them, considering that I dont know the content of those files.
Find attached just an example with only one of those variables.
two three points:
- You cannot wire an array (of any type) to a case selector.
- You cannot wire a reference (of any type) to a case selector.
- You cannot select cases by the names of global variables connected to case structures selector. (What's the point in trying to do so? The connection is static and done at development time, so you know which global is connected...)
Try investigating the concept of LVOOP
in LVOOP (classes) you have the ability to use the concept of dynamic dispatch to automatically call child methods
Just to explain GerdW, I use this VI several times in my code... I want to use the same VI for doesn't matter which global is connected (actually I dont know which one is connected, depends of each step in my test), I just send attached a simplification of what I am doing. And the purpose is also because in the future I may have even more than 8 globals using this VI.
So, for the moment I am improving this existing VI and now, as I need to use different shift registers for each global, I really need different cases.
I know that an "stupid" (and somehow easy) solution could be to create one VI for each global, but then I have to replace those VIs in my whole code (several times when it appears) and in the future will also require more work if I need to keep improving this.
That is why I need one VI that allows me to use different shift registers according to the global that is connected in that moment!
I know that I can not connect this directly to the case structure, I just wonder if there is any manipulation of data that can, for instance, read the name of the global and convert it to a string.... or something like this...
II will read more but please, maybe somebody has any idea how to make it, I appreciate 🙂
when you want to use references as shown you can get the label of the referenced control and use that label as selector for the cases. Be sure to use the correct name for the cases. And you need to use a (FOR) loop around your case structure...
GerdW, I really didnt figure out how to get the label from this kind of type of data. My refnun doesnt keep the label from the label of the global. in the moment I have 8 globals, but maybe 100 different refnuns (because depends of each test).
for the moment I am using an existent enum whichcontains the name of those globals, but is bad because I need to add this enum everywhere I call this VI to conect to this new input 😞
sorry, I mixed up the file references with control references...
The enum approach seems to be the way to go. I really recommend to define the enum as type definition!
yes no problem... It was already a typedef... and ok, not so much work to put this in my code...
now I have other troubles with this writing data because the modification i did in the VI completely destroyed my results files 😞 lets see... but thanks for attention!