LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create multiple Enum constant without doing it manually one by one?

Highlighted

Just learnt LAbview only a week ago. My supervisor had assigned me a project and asked me to create multiple number constant without doing it manually one by one. Any help or suggestions will be helpful.

 

Thanks.

0 Kudos
Message 1 of 30
(1,461 Views)

Im a little confused by your question, if he wants you to programmatically create these constants you can use vi scripting, i provided some links on that.  If you want a single enum constant that updates every instance of that vi when it is changed you should use type def.

 

attached example

 

Create enum example

 

Enable vi scripting.

Regards,

Matt
0 Kudos
Message 2 of 30
(1,443 Views)

Thank you for your reply. Sorry if I didn't explained it properly. Basically, my supervisor wants me to create a bunch of Enum constant into a loop sort of . Hope this helps.

 

Thanks.

0 Kudos
Message 3 of 30
(1,427 Views)

It's a shame that your boss has tasked you to do something you know so little about that you can't even ask a basic question about it.  Smiley Sad  This no reflection on you.  It's like me trying to ask an intelligent question about assembly language.

 

I'm also having a difficult time understanding what it is you are trying to ask.  Smiley Sad

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 30
(1,411 Views)

Yeah, but you've gotta learn what you don't know,right? I'm sorry...I don't know how I can rephrase my question to make you understand better Smiley Sad

0 Kudos
Message 5 of 30
(1,409 Views)

Try explaining your task.  It doesn't make sense to create an enum in a loop.  You'd need to be doing some kind of scripting that wouldn't really be all that useful if you're new to LV.

 

If you want to just copy it, copy/paste works.

 

If you want them to be linked, take a look at typedefs.  I'd strongly suggest looking at this first.  Once you make the typedef, then copy/paste works much better

0 Kudos
Message 6 of 30
(1,354 Views)

Create an array of Enums? I think that's what the instructors means but asked for in a "puzzle" way as to not give you the answer.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 30
(1,341 Views)

On top of that the objects you have circled are actually Control Terminals, not constants.  That might also be part of the confusion of what you are actually trying to do.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.
Checkout and help contribute to the community driven LabVIEW Wiki.

0 Kudos
Message 8 of 30
(1,321 Views)

Creating enums can be done without resorting to scripting. Generate an array of the strings you want, push them into the [Strings] of a ring property node and let the code run. Then right click the ring and choose "replace" and then choose an enum. Save the enum as a typ-def and you are done.

 

So scripting is not required except for the last step.

 

I also belive that you can set the strings of a enum provided the enum is not part of a VI that is reserved to run. Again no scripting required.

 

Ben 

Message 9 of 30
(1,311 Views)

@Ben wrote:

Creating enums can be done without resorting to scripting. Generate an array of the strings you want, push them into the [Strings] of a ring property node and let the code run. Then right click the ring and choose "replace" and then choose an enum. Save the enum as a typ-def and you are done.

 

So scripting is not required except for the last step.

 

I also belive that you can set the strings of a enum provided the enum is not part of a VI that is reserved to run. Again no scripting required.

 

Ben 


My favorite way of populating a huge enum - especially if I want to exactly match a document.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 10 of 30
(1,301 Views)