This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

LabVIEW VI Sequence Pattern

Updated May 16, 2023

Reported In

Software

  • LabVIEW

Issue Details

I am developing a single VI application in which I want to execute a series of pre-defined steps. Therefore, I am looking for a clean solution that keeps my code organized, easy to read, and contained within this one VI without having to create subVIs for every step of the process.

Solution

The sequencer design pattern is a way to organize code on the block diagram without hiding code behind subVIs. With the sequencer pattern, you can have one VI that cycles through your pre-defined steps and keeps the code visible to develop.
 

Other cases just have wired the Data (pink) cluster.
 
  1. The Sequence array of hard coded strings represent the abstract ideas to be sequenced. This array can act as a summary of your code. 
  2. The Anything cluster is local data used between sequences. This should not be turned into a Type definition unless it is passed into a subVI.
  3. The For loop iterates through all the sequences in the order specified by the sequence array. As a modification, you can place a case structure around the sequence array and pass a "mode" into the sequencer to change its behavior.
  4. The inner Case structure contains the implementation details of each sequence.
  5. The error handler creates a custom message indicating which sequence failed and with what specific error. Upon error, the sequencer aborts.

Additional Information

Find a working example in: Sequencer Template - Example Program .