Symplify Now! is released. Run tests Today

Close

Duplicating cases to quickly test multiple code implementation

LabVIEW is a great programming environment for test and control systems but it can be challenging for beginners to keep the code visually clean, especially as quick tests and validations are added.

Symplify templates are based on a Case Structure inside a While Loop, akin to a “State Machine” (NI Link) or a Producer/Consumer (NI Link) bundled inside the same loop. As such, there is no inherent limit to the number of cases that can be added within the code or the naming of those:

Case structure with standard case in Symplify
Case structure with standard case in Symplify

When you want to try another version of your code, right-click on the case name and select “Duplicate”.

Symplify Duplicating cases to quickly test different options Menu to duplicate
Duplicating a case to try a different logic implementation

Just name that case something like “Backup original logic – 2020-11-15” and leave it untouched. As you complete changes in the original case, it’s simple to swap the names to run the original code and compare performance and results (read this blog post about modifying a single VI while application is running).

Symplify Duplicating cases to quickly test different options Duplicated Code
A bright color background in the case that are not being used help future development

You can even repeat this more than once, creating a few similar cases while retaining the other “versions” of the logic untouched! Our clients and developers find this to be a very natural way to progress and try things out without relying on “Undo”.

Two things to keep in mind:

When using this, (the) trick is to replace actual Controls and Indicators by Local Variable. Otherwise, a new copy of each control/indicator is created in the new case.
Always add some quick comments about what you are trying to achieve. When the issue is solved, most developers don’t revisit the code to clean things up so the notes are already there for the future.

Benefits

As we stated in the introduction, this approach really helps keep the code clean and fit within a single screen. Also, unlike a “Diagram Disable Structure”, it is actually possible to decide which version of the code to execute at run-time. For example, the case “Parse Values” may be significantly faster to search for an entry but “Parse and Sort Values” be required at times to support user interaction.

This trick should work with many other VI architectures.



Synovus Resources

Fill the form below to access all our resources. We won't ask you again later.

  • By submitting this form you allow us to send you monthly updates on our services and news.