JDave Posted March 22, 2006 Report Share Posted March 22, 2006 I tend to used type-def enum's to keep track of messaging commands, VI lists, whatever. Often I want to grab the text of the enumerated type, which is quite simple using the 'Format Into String' vi. If I have a sub-VI that needs a String input, it would be nice to simply wire the Enum into the node, giving me an automatic coercion without forcing me to put the 'Format Into String' vi inbetween. This is possible for numeric inputs to sub-vi's. And the Enum type is a combination of string and numeric, so it shouldn't be difficult to add. Not a big deal, but it has annoyed me recently. David Quote Link to comment
Mike Ashe Posted March 22, 2006 Report Share Posted March 22, 2006 Do you have the OpenG Toolkit installed? I believe there is a function that will give you a quick conversion. It's not a coercion dot, but it's pretty easy. Quote Link to comment
Jim Kring Posted March 22, 2006 Report Share Posted March 22, 2006 Do you have the OpenG Toolkit installed? I believe there is a function that will give you a quick conversion. It's not a coercion dot, but it's pretty easy. Right, you will need to make the input a Variant, which anything will coerce to, and then extract the string value of the variant using the Get Strings From Enum function in the lvdata (LabVIEW Data Tools) package. Quote Link to comment
Mark Balla Posted March 22, 2006 Report Share Posted March 22, 2006 I tend to used type-def enum's to keep track of messaging commands, VI lists, whatever. Often I want to grab the text of the enumerated type, which is quite simple using the 'Format Into String' vi.If I have a sub-VI that needs a String input, it would be nice to simply wire the Enum into the node, giving me an automatic coercion without forcing me to put the 'Format Into String' vi inbetween. This is possible for numeric inputs to sub-vi's. And the Enum type is a combination of string and numeric, so it shouldn't be difficult to add. Not a big deal, but it has annoyed me recently. David Why not give your subvi two inputs a string and an Enum. If the String is empty use the Enum and convert otherwise use the String input. Polymorphic vis might be a solution too. Quote Link to comment
jpdrolet Posted March 22, 2006 Report Share Posted March 22, 2006 .... This is possible for numeric inputs to sub-vi's. ....David Is it possible for numeric inputs? Quote Link to comment
Grampa_of_Oliva_n_Eden Posted March 22, 2006 Report Share Posted March 22, 2006 Is it possible for numeric inputs? i read that phrase as "...simply wire the Enum into the... numeric inputs to sub-vi's. " Ben Quote Link to comment
Yair Posted March 22, 2006 Report Share Posted March 22, 2006 Is it possible for numeric inputs? If you have a numeric control in a subVI and you wire an enum into it, it will be coerced. My understanding is that David wants the same to happen with a string control. Quote Link to comment
jpdrolet Posted March 22, 2006 Report Share Posted March 22, 2006 If you have a numeric control in a subVI and you wire an enum into it, it will be coerced. My understanding is that David wants the same to happen with a string control. OK I read that it was possible for numeric to be converted to a string input. The world can resume its rotation now. Quote Link to comment
JDave Posted March 22, 2006 Author Report Share Posted March 22, 2006 Thanks for all the feed back. Sorry I was so ambiguous with my first post. I am aware of the various work-arounds, and have used quite a few. I don't quite like having two separate inputs (string and enum) but polymorphism or a variant input are my favorites. The variant input requires me to see if the input was an enum, string, or something else. A bit of extra work. The reason for the "wish" is that sometimes there are vi's already written that take string inputs (or vi.lib vi's for that matter). If the enum contains the number and the strings in it's type, a coercion dot is not unreasonable. By the way, I have loved the OpenG toolkit and the Variant-Enum vi's have been very handy. Thanks for all your hard work. David 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.