From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop an event on a value signal or a button press

Solved!
Go to solution

When programming for an event via an Event Structure, how do you handle events that are either triggered via a Value Signal or a button press when more processes have to be processed within the same Event? Take a look at the Test Sample:Value change area (5th event). I've stopped coding because I didn't want to have 4 different case structures.

 

I would appreciate your suggestions.

0 Kudos
Message 1 of 6
(2,540 Views)

I'm not understanding what you are going after.  Are you trying to get multiple events to be handled by the same event case?  Are you trying to run a test and need to handle events to stop it?  We need a little more clearification.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(2,534 Views)

In that specific event structure there will be events happening (with SubVI's) that could either:

 

  • Throw an error, or
  • The user could press the stop button at anytime

I need to capture the error to trigger the Stop event or capture the pressing of the Stop button and act accordingly (which the Stop event hasn't been coded yet) without going through the entire Test Sample event.

 

0 Kudos
Message 3 of 6
(2,528 Views)

You are about half way there but not quite the right design pattern to achieve what you want. 

 

Take a look at the Producer Consumer (Events) template and example.  These show one way to implement a Queued Message Handler that will let you respond to user requests (or errors). 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(2,521 Views)

That should work, Jeff. Thank you.

 

Question - can I make the Consumer Loop a Sub VI (since it is large) and keep the Producer with the Event Structure in the Main VI?

0 Kudos
Message 5 of 6
(2,509 Views)
Solution
Accepted by topic author Eric1977

@Eric1977 wrote:

That should work, Jeff. Thank you.

 

Question - can I make the Consumer Loop a Sub VI (since it is large) and keep the Producer with the Event Structure in the Main VI?


You certainly can.  That's the way a Champ would do it


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(2,505 Views)