LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Measurement Technology Center-JPL

case structure renumbering

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

Assuming that I have a case structure with numbered cases, I would like to be able to add a case anywhere and have LabVIEW renumber all the cases for me. This would be like the opposite of sort, which rearranges the order of the cases but leaves their numbers alone, instead, this would renumber all the cases but leave their order alone.

9 Comments
altenbach
Knight of NI

Maybe I don't understand this right, but this seems very dangerous and unpredictable, because the functionality if the structure changes when you do this.

 

Could you please add a picture or example to clarify what you actually mean?

 

How about for string cases, enum cases?

Measurement Technology Center-JPL
Member

I often use a case structure inside a For Loop to implement a sequence structure. The advantage of doing it this way is that I don't have to have a separate error output (for example) for each case. If I were using a sequence, it would be very easy to add another frame in the middle somewhere but with a case structure, I have to renumber all the cases after the one I am adding. I know it could be dangerous, but it is alway predictable. This would be meaningless for string and enum cases. It's only for numbered cases inside a For Loop.

RavensFan
Knight of NI

That's kind of a poor man's state machine.  If you really need the functionality to add a case in the middle of a sequence, you would do yourself a favor by getting away from hard coded 0, 1, 2, 3 ... case structures and implement a real state machine that uses type def'd enums.

Measurement Technology Center-JPL
Member

A state machine allows you to jump from any case to any other case, and I would see why you would think this was dangerous. It's not a state machine in my application, it's merely a sequence structure but with the added feature that I want to pass an output from every case (frame) into the next one. If I actually do it with a sequence structure, I will have a whole lot of sequence locals. Doing it with a case structure in a For Loop (with a shift register) is much cleaner. I'm not going to change the way I do it but it would be helpful to have the renumber feature.

tst
Knight of NI Knight of NI
Knight of NI

A better implementation for that would probably be the ability to add shift register to sequence structures, but that seems unlikely to happen - http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Stacked-Sequence/idi-p/918243


___________________
Try to take over the world!
Measurement Technology Center-JPL
Member

You mean, add a shift register in place of a sequence local? Hey, you should enter that as a suggestion.

altenbach
Knight of NI

Well, your technique is just a sequence structure with lipstick. 😄 I don't like it.

 

> Hey, you should enter that as a suggestion.

 

Did you look at the link? It is a suggestion. You might want to read the comments.

Measurement Technology Center-JPL
Member

No, I hadn't looked at the link until now and I read the comments and I'm sorry that I entered my suggestion. I really don't want to debate this anymore.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.