LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV 8.5.X: Enum Constant, Number of Elements

Hello,

I want to determine the number of elements of an enum constant, is
that possible at all?

Thanks and greetings,
Udo
0 Kudos
Message 1 of 10
(3,870 Views)
"
I want to determine the number of elements of an enum constant, is
that possible at all?
"
 
THat could be a little tricky since you don't have properties. I'd first try to use a flatten to string (configure for the LV 7 version) and then parse the type descriptor.
 
Anyone have any better ideas?
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 10
(3,865 Views)
Number of Items property node?

Oh. Just noticed that he said Constant.

Lynn

Message Edited by johnsold on 06-09-2008 04:04 PM
0 Kudos
Message 3 of 10
(3,860 Views)
That is for me interesting too. I use Enum-Typedef to enumerate my Tasks (parallel Loops) and want to create one queue per Task. So I take my enum-CONTROL and than the property of them to get all strings from the list to give my queues the names from the list. But I would prefer to use enum constant for this. Is it possible?

Thanks
0 Kudos
Message 4 of 10
(3,856 Views)


Message Edited by Ben on 06-09-2008 03:44 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 10
(3,846 Views)
There is an OpenG VI to get the possible string values of an Enum. The length of the returned array is the number of possible values.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 10
(3,843 Views)
Thank you, my question is answered. I can use flatten 7X and then format into string for my issue.
0 Kudos
Message 7 of 10
(3,835 Views)

Ben,

What is the thing behind indexing 2?

I mean, how will I have to know that when I index 2, I ll get the Enum constant's item count...

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 8 of 10
(3,802 Views)
 


@parthabe wrote:
 

What is the thing behind indexing 2?

I mean, how will I have to know that when I index 2, I ll get the Enum constant's item count...



That is buried inside the LabVIEW data-type definition:

Enumerated 8-Bit Integer

In the following example of an enumerated 8-bit integer for the items am, fm, and fm stereo, each group of characters represents a 16-bit word. The space enclosed in quotation marks (" ") represents an ASCII space.

0016 0015 0003 02a m02 fm 09f m" " st er eo

0016 indicates 22 bytes total. 0015 indicates an enumerated 8-bit integer. 0003 indicates there are three items.



Here's the VI I was talking about.

Ton



Message Edited by TonP on 06-10-2008 09:15 AM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 9 of 10
(3,792 Views)
Hello Ben,

yep, many thanks for your superb solution and efforts.

Greetings
Udo
0 Kudos
Message 10 of 10
(3,765 Views)