LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

type cast

Solved!
Go to solution

Hi Clint,

 

you need to work with this enum "in the whole wire". Right now you use a numeric (or ring) in the loop and so the shift register keeps this numeric. The enum to the left is coerced to your numeric value at the coercion dot.

 

Enums usually are used as typedef as it really helps to keep all instances of that enum in sync!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 19
(1,190 Views)

I know. Type defs are great.  So I guess if I make the "current state" and the "next state" enums I won't need the type cast?

 

 

Thanks.

0 Kudos
Message 12 of 19
(1,181 Views)

Hi Clint,

 

if I make the "current state" and the "next state" enums I won't need the type cast?

You need to make them enums of the very same kind as your enum input, hence the typedefinition!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 19
(1,179 Views)

@Clint1000 wrote:

I know. Type defs are great.  So I guess if I make the "current state" and the "next state" enums I won't need the type cast?


If you use the type def enum for all of your states, then the type cast is not needed.  But here is the problem: if you do this, that subVI will not become truely generic.  It will be bound to this state machine.  You can use it freely in all states of your state machine, but it will not work in another state machine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 14 of 19
(1,170 Views)

I thought I had this "licked".  is there a way to to "convert " the enums from text to a number??  What I'm trying to do is allow the user to select from a menu of 20 particular tests.  Example:  Power supply test (#1)..LP transduer test(#2)..HP transducer test(#3)..etc.  The user can select one or any combo.  I was using boolean array to number to see which boolean menu item the user selected.  The the test would then proceed running only selected test.  crossrulz I had seen some of your posts suggeting maybe combo boxes..I can't find combo boxes to even read up on!!  Where are those???  In my earlier post I got a coersion dot because I was going from enum to integers and you said bad things can happen if I don't correct it.  How would I do that or should I even use that approach??Any suggestiosn for my current problem??

Thanks..

0 Kudos
Message 15 of 19
(1,111 Views)

What's wrong with just working straight off of the enum?  You can make an array of these enums and the enum can go straight into the case selector of a case structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 16 of 19
(1,105 Views)

that could be the answer.  I'll give it a try.  Right now I have the enum in a dowhile w a shift register.  My last case is stop or end.  i do nothing but pass the STOP a true.  if I do the array I'll have to index it some how but that looks like the best solution yet.  Don't know if this is the right place for this post but is there a way to tell what is missing in a type def??  I'm getting the coersion dot on an enum ctl when i do a bundle unbudle by name going into a subvi.  I've opened the ctl control and the ctl indicator ( both type defs ) and can't find why the dot...something maybe missing but it doesn't jump out at me.

 

thansk..

0 Kudos
Message 17 of 19
(1,068 Views)
Solution
Accepted by topic author Clint1000

@Clint1000 wrote:

that could be the answer.  I'll give it a try.  Right now I have the enum in a dowhile w a shift register.  My last case is stop or end.  i do nothing but pass the STOP a true.  if I do the array I'll have to index it some how but that looks like the best solution yet.  Don't know if this is the right place for this post but is there a way to tell what is missing in a type def??  I'm getting the coersion dot on an enum ctl when i do a bundle unbudle by name going into a subvi.  I've opened the ctl control and the ctl indicator ( both type defs ) and can't find why the dot...something maybe missing but it doesn't jump out at me.


The indexing is simple.  You can either just use a FOR loop and autoindexing (by far the simplest) or use a shift register to keep track of your index and use Index Array.

 

For the coercion dot, make sure they are the SAME type def enum.  If they are different ctl files, even if everything is exactly the same, you will get the coercion dot (they are technically different types after all).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 18 of 19
(1,055 Views)

thanks!!

0 Kudos
Message 19 of 19
(1,031 Views)