LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a cluster control in a config file?

I am trying to create a config file that will be able to enable/disable channels and control the range of the channel. The settings for each channel are stored in a cluster. There is a boolean value for channel enable, a value for the coupling, and a value for the input range. From what I've found it seems like you have to convert the cluster into a xml string, but when I put an indicator after the flatten to xml it only displays <Cluster>. Is there a simple way to be able to separate them, to create configs for each case that will be used?

0 Kudos
Message 1 of 8
(3,410 Views)

There are some toolkits that make this really easy. I like the MGI Read/Write anything and OpenG Variant Config toolkits, both of which can be downloaded through VIPM.

Message 2 of 8
(3,395 Views)

@randomguy77 wrote:

From what I've found it seems like you have to convert the cluster into a xml string, but when I put an indicator after the flatten to xml it only displays <Cluster>. \


Your problem there is that XML is a multi-line format.  So you are probably not showing the rest of the lines in your indicator.  Worse still is that this will not work inside of a configuration file.

 

Use the MGI or OpenG toolkits already mentioned.  They have done all of the work for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(3,366 Views)

I've seen OpenG mentioned a few times no so decided to try it. Every time I try to install it through VIPM is keeps failing to install. I'm not able to access sourceforge with my work network, so guessing I'll just have to download it at home and throw it onto a junk drive to give it a go. 

0 Kudos
Message 4 of 8
(3,364 Views)

This could be because you don't have the latest version of VIPM, or you need to run VIPM as administrator, or it is being blocked by your firewall.

 

Also, do try the MGI toolkits, I actually prefer their version for config files, and it scales much better with larger data.

0 Kudos
Message 5 of 8
(3,355 Views)

I download the MGI kit as well, I'm playing around with that right now trying to figure out how it changes the cluster values and what all needs to be done to setup it correctly.

0 Kudos
Message 6 of 8
(3,345 Views)

The to/from XML should work well, but you'll need to Escape/unescape the text so you don't get strange effects.
ReadWrite Cluster as XML.png

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 8
(3,309 Views)

I'd personally won't store a cluster in a single key.

 

Instead, I'd make a section, and store the elements in keys. You'll avoid the huge problems if (when) the order of cluster elements changes, or if an element is added or removed.

 

To\From XML will fail when the cluster changes (ironically, since XML should be flexible).

 

The simple solution is to format a string from the elements. So simply use a format into string and scan from string to set\get the string.

 

And obviously clusters like these are good candidates for classes. Then each class can store and load itself... A section\key construct will work better for this as well.

Message 8 of 8
(3,297 Views)