LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling polymorf VI in loop selecting variable type at runtime

Hi,
I'd like to write a vi that loops through a cluster of variables (with different data types - arrays of simple data types) and writes or reads these from ini file, using the Configuration File vi's. The objective is to reduce scope of errors in reading and writing the variables, since I'm planning to use the variable name and its position in the array to determine its Configuration File name. I'm planning to use almost the same code for reading and writing the variables, thus ensuring that if I've wired a variable into the input cluster I will both correctly write and read it.
 
There is one problem though - the Read Key.vi or the Write Key.vi are polymorph, but the right instance is selected at compile time. Any way I can solve this?
 
One way is to check which variable type I have, then select the appropriate case and write to config file. Anything better?
0 Kudos
Message 1 of 11
(3,837 Views)
Easy solution: Get the OpenG libraries. They have a VI that writes a cluster to INI file. I think it's in the "variant" library.

Alternate solution: Instead of the config VIs use the XML functions that come with LabVIEW.


Message Edited by smercurio_fc on 01-18-2008 09:23 AM
0 Kudos
Message 2 of 11
(3,836 Views)
Any way of getting the OpenG without the JKI VI Package Manager?
0 Kudos
Message 3 of 11
(3,823 Views)
The VI Package Manager is by far the easiest way to do it. You can download them directly from sourceforge.

Why don't you want to use the VI Package Manager?
0 Kudos
Message 4 of 11
(3,815 Views)
Because it's not managing to connect - probably being blocked.
Additionally, if it's always updating the libraries, how do I keep track that what I've just used isn't being changed, so that I end up with 2 subtly different vi's in different apps?
0 Kudos
Message 5 of 11
(3,794 Views)

I discussed this topic in my Adaptive Save-Restore Nugget. That article may give you some ideas.

Just trying to help,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 11
(3,784 Views)

Did this result in any useable code for creating an ini file?

Did one reach a conclusion whether this is better than the corresponding OpenG code?

0 Kudos
Message 7 of 11
(3,778 Views)

Yes it creates ini files.

Better?

It is a matter of taste. You can use the code as is or just use it for inspiration.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 11
(3,773 Views)


@Rodnebb wrote:
Because it's not managing to connect - probably being blocked.
Additionally, if it's always updating the libraries, how do I keep track that what I've just used isn't being changed, so that I end up with 2 subtly different vi's in different apps?



That's possible. Could be your firewall, though it's also possible the servers were down.

The libraries are not automatically always updatied. The libraries are only updated when you choose to do so. As for the subtly different VIs, that happens with anything, including the VIs distributed by NI, as many of us have found out during the many iterations of LabVIEW.
0 Kudos
Message 9 of 11
(3,759 Views)


@Rodnebb wrote:
Because it's not managing to connect - probably being blocked.
Additionally, if it's always updating the libraries, how do I keep track that what I've just used isn't being changed, so that I end up with 2 subtly different vi's in different apps?



Rod,

Sorry for the late post.

If you can't connect, this might be from an aggressive firewall settings. Several user have reported this.

In regards to libraries update, when you check the network for available packages, you will get a list of package and you can select which one to install.

But even if you were to constantly install new packages, VIPM professionnel provide a solution for this. It allows you to scan your project for packages dependencies and to create VI Package Configuration (VIPC for short) that store all the informations about your project package dependencies. Then in one click you can apply this VIPC file to set your LabVIEW configuration to use the specific set of packages define in the VIPC. This way you can be sure you are always working with the same set of packages on a given project.

Visit http://jkisoft.com/vipm/professional/ for more informations, or contact us if you would like to try VIPM Professional.

Cheer

PJM




Message Edited by PJM_Labview on 03-07-2008 09:28 AM


  


vipm.io | jki.net

0 Kudos
Message 10 of 11
(3,652 Views)