09-23-2013 10:36 AM
Hi.
I have a case structure with two cases. I have now decided that one of the cases is unnecessary. I have deleted the contents of that case. Is there a way for me to delete the case structure while preserving the contents of the good case as the only remaining code? I am aware of the possiblity of cutting the good code, deleting the structure, and then repasting the good code in the empty space; however I am somewhat hesitant to do this due to the possiblity of losing some connections.
Thanks.
Solved! Go to Solution.
09-23-2013 10:40 AM
Make the case that you want to keep visible, right-click the structure and choose "Remove Case Structure".
09-23-2013 10:48 AM
@Charles_CLA wrote:
Make the case that you want to keep visible, right-click the structure and choose "Remove Case Structure".
So, as you can see, you don't need to empty out any other cases first, but you'll get a warning about code in other cases if you don't to make you aware that currently invisible code will be deleted behind the scenes.
The same techique works equally well to remove other structures (loops, sequences, etc.) while leaving the code intact. It is a core skill that any LabVIEW programmer should know!
09-24-2013 07:10 AM
It has also been a core trick of scripting enthusiasts for over a decade. If you use template-based scripting (and you should), you can include conditionally scripted code in case structures. By selecting the right case and deleting the structure, you get conditionally generated code in a simple manner. The template-based codegen engine included with LabVIEW has this functionality.