LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

typedef update

I'm using a ring indicator both as a feedback to the user to indicate what stage a program is at and as an input to a case structure within a while loop.

 

The idea is that the text will tell the user what the program does & the program executes whatever case number that text corrosponds to. In some of the cases, I am using property nodes for the ring indicator to select which case gets executed on the next loop iteration. To acomplish this I make set the value property of the ring indicator to read & create a constant for it. These constants are like a dropdown menu with all the text values for the ring. It works find until I need to add extra cases. When I do that, the drop down constants do not update to reflect the changes, although if I remove the constant & replace it with a new one, the changes are there.

 

I have many of these in my program, so doing this would not be a great option. Is there any way of ensuring these constants get updated when the indicator is changed or are the values set in stone when the constant is created?

 

I tried making the indicator a typedef (strict), but that was just desperation 🙂

 

Thanks for any help.

 

Joe

0 Kudos
Message 1 of 17
(5,153 Views)

Did you try a search? This has been brought up many times. The typedef defines the datatype, not the properties. A ring is a numeric value and hence the strings are not part of the datatype. What you want is an enum.

Message 2 of 17
(5,149 Views)

I did try a search but did not find anything to help my situation. I just tried replacing a ring with an enum now. All that does is show a broken wire on the block diagram between the constant and the property node for the emum when I add extra items in the typedef & apply the changes.

 

I feel it should work but that I'm missing somthing.

 

Joe

0 Kudos
Message 3 of 17
(5,140 Views)

make a constant from your typedef enum.  Then they will update as well... But you will have to do this EVERYPLACE that you have used a constant.


Paul
0 Kudos
Message 4 of 17
(5,133 Views)

And that is exactly what I'm trying not to do. I've got quite a few constants to update otherwise....

 

Joe

0 Kudos
Message 5 of 17
(5,130 Views)

@PJS wrote:

make a constant from your typedef enum.  Then they will update as well... But you will have to do this EVERYPLACE that you have used a constant.


But if he plans to change the values at run time, we have to forget about type defs and explicitly code up all instances of the ring.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 17
(5,129 Views)

 

 


@Ben wrote:

@PJS wrote:

make a constant from your typedef enum.  Then they will update as well... But you will have to do this EVERYPLACE that you have used a constant.


But if he plans to change the values at run time, we have to forget about type defs and explicitly code up all instances of the ring.

 

Ben


He has run into the issue of ADDING things to the ring as he has programmed along.  I do not see an 'easy' way of doing this without making the changes he is avoided.  Painful, but lesson learned.  I try to avoid rings UNLESS I am modifying at run time.  And even then I usually load my rings from a configuration manager.  But I learned this lesson much the same as everyone else has at somepoint in their labview programming experience.... Get bitten then don't do that again!

 


Paul
0 Kudos
Message 7 of 17
(5,117 Views)

 


@Joe McC wrote:

And that is exactly what I'm trying not to do. I've got quite a few constants to update otherwise....

 

Joe


 

You would only need to do this once if you use a typedef. PJS was referring to the initial replacement of your ring constants with instances of the typedef enum. Once this is done, updating the enum will automatically update all instances of it, whether they're controls, indicators, or constants

 

0 Kudos
Message 8 of 17
(5,115 Views)

The use of an enum solves the problem in terms of updates from the type def, but it is not programmable during run time.  Hence, we are still stuck with this one. 

0 Kudos
Message 9 of 17
(4,976 Views)

Maybe better to start a new thread but off-hand I'd think and AE could be developed to update all ring instances at run time.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 17
(4,956 Views)