LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing values between event structure cases

Hello everybody,

 

I have a question concerning the event structure  - how to pass values (let's say a string / the state of a boolean control / the value of a numeric control value / an array of numeric values) between event cases ?

 

There seem to be 2 situations here  :

 

- when you need to pass the value of the control that triggers an event;

- when you need to pass the value of a control which is modified in an event case.

 

I have read the documentation but i still do not understand very clearly how to do this. Maybe you can point me in the right direction (maybe some threads on the forum that i have missed).

 

Thank you very much !!

 

(KUDOS for everyone who is interested in this )

0 Kudos
Message 1 of 8
(6,401 Views)

Which is better from the optimision of memory point of view :

 

- passing values from one case to another by reference ?

 

- passing values from one case to another by shift registers ?

 

Thank you !

0 Kudos
Message 2 of 8
(6,373 Views)

The node ctrl.newVal comes to mind.   However, it is very rare that more than one event structure is desired.  May be I am unclear what you are trying to do.  Can you upload an example?


"Should be" isn't "Is" -Jay
Message 3 of 8
(6,349 Views)

Hello !

 

Thank you very much for your answer !

 

However , the question was about passing data between  the cases of an event structure.

 

For example :  i do a string manipulation in one case and then i use the resulting string in another case.

 

How can this be achieved in the best manner ?

0 Kudos
Message 4 of 8
(6,337 Views)
Use a shift register.
Message 5 of 8
(6,328 Views)

@AndreiN2014 wrote:
 

- when you need to pass the value of the control that triggers an event;

- when you need to pass the value of a control which is modified in an event case.

 


The first question isn't worded very well.  What exactly are you looking to do?  Are you looking for an event that specifically relates to that control?  If so, just drop it inside of the event and wire it.  Are you looking to trigger multiple events from the same control?  Ie, you hit the control, event1 is triggered which then triggers event2 ... ?  If so, you might consider taking a look at a different architecture.  I can think of very few cases where I'd prefer do this over something like having the button trigger a state and using the state machine architecture. 

 

Others have pointed out the Shift Register.  This is the typical way to pass values between one iteration of a loop to another.  We can assume you have some sort of loop outside of the event structure to make it run a second time.  Put a shift register on this loop and the value wired into it will pass each iteration.  But, if it's just a random control, you can also just leave that outside of the event structure and wire it in as well.  This will provide the new value to the next occurrence of the event structure.

 

You really need to define your problem before trying to solve it.

0 Kudos
Message 6 of 8
(6,316 Views)

@natasftw wrote:

@AndreiN2014 wrote:
 

  We can assume you have some sort of loop outside of the event structure to make it run a second time.  

 

You really need to define your problem before trying to solve it.


Point A.  We can not assume that!

Point B. Exactly!:-) 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(6,298 Views)

If they've reached the point where they can't get data to the second iteration of the event structure, they must have found the loop to get back to it.  I'm giving them enough credit as to not have a series of structures lined up one after the other 😛  This especially sounds true when they clarify they only have one on the BD 😃

0 Kudos
Message 8 of 8
(6,271 Views)