Graeme Posted June 20, 2007 Report Share Posted June 20, 2007 Hi all, Once again I seek the wisdom of those a little more clued up on LV than I am! I have a main VI that runs some automatic tests. On the VI's front panel there are some control clusters, via the elements of which the user enters test condition information prior to running the test (operator name, path loss, test frequency etc., all that kind of stuff). The test results are written to file but I would like to write the test conditions (i.e. the cluster element values) to file as well. So the problem is converting a cluster's elements, which may be mixed data types (but are most likely to be Numeric, String, Path or Boolean), to strings. I have a VI that I've attched that seems to do the job nicely. However, I look at it and can't help feeling there must be a neater way of doing it. Something using variant data nags away at me but I can't get anything going with that (never been much good using variant data!). One last stipulation, the conversion of a Numeric must result in a string that appears exactly as the number appears in its Numeric control, not any different format. I'd be interested if any of you have any suggestions. Many thanks. Regards, Graeme. Quote Link to comment
PaulG. Posted June 20, 2007 Report Share Posted June 20, 2007 OpenG's Variant Configuration vi's might be perfect for this. I was rather intimidated by variants myself until I started playing around with this stuff. http://forums.openg.org/ Quote Link to comment
ASTDan Posted June 20, 2007 Report Share Posted June 20, 2007 Hello, This is how I save and retreive Cluster values from files. What is great about this method is I can add or delete values from my clusters and it doesn't mess up the files. Quote Link to comment
orko Posted June 20, 2007 Report Share Posted June 20, 2007 If you just want to save this data in a file and retrieve it later, then flattening to an XML format may prove useful. http://forums.lavag.org/index.php?act=attach&type=post&id=6159 http://forums.lavag.org/index.php?act=attach&type=post&id=6160 QUOTE(Graeme @ Jun 19 2007, 12:31 PM) One last stipulation, the conversion of a Numeric must result in a string that appears exactly as the number appears in its Numeric control, not any different format. Using a typedef cluster as I did above, the display format is saved for you in a .ctl file, so you needn't worry about the text file holding the formatting. Hope this helps Quote Link to comment
jpdrolet Posted June 20, 2007 Report Share Posted June 20, 2007 Your approach is correct. The use of variants wouldn't help much since you would still have to retrieve either the format string or the displayed string of each control anyway. You can take a look at OpenG's "Format Variant into String" that formats a variant scalar input into string. You can specify the format string either at the input or as a variant attribute. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.