LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

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
(4,404 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.



-Matt
0 Kudos
Message 2 of 30
(4,386 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
(4,370 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.  😞  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.  😞

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
(4,354 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 😞

0 Kudos
Message 5 of 30
(4,352 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
(4,297 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! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 30
(4,284 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.

0 Kudos
Message 8 of 30
(4,264 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 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 30
(4,254 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
(4,244 Views)