Execute an Event Case Immediately When Starting an Application

Updated Aug 25, 2023

Reported In

Software

  • LabVIEW

Issue Details

I want my LabVIEW application to immediately execute a particular case in my event structure without having to click a button or anything and then wait for normal events to occur.

Solution

You can add a shift register on the while loop to control the timeout condition that gets initialized to 0 (no delay) and then overwritten with -1 (infinite wait) after the first iteration.


The timeout case will contain your initialization code, within which you can also include additional event conditions. See the VI snippet below.



When you run the attached VI, it executes the [0] case immediately and then waits infinitely for value changes on either of the two addends. After the first iteration of the while loop, it behaves exactly like a typical event structure.

Additional Information

Note: If you like to run this logic in a WebVI in LabVIEW NXG in order to execute it well you will need to set the timeout condition that gets initialized to 1.

If you set it to 0 the event structures don't get triggered.