LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with 2 event structures in one VI

Solved!
Go to solution

Hello,

I have a issue with 2 event structures in the same VI, I think my approach is wrong but I do not know how to correct it.

Here is what I want to do:

With the 1st event structure, the user select data from a database and put the selected data in a table array, he should be able to do it several times in order to pick up all the desired data.

Then the 2nd event structure should be able to call the final data in the table array and treat it.

However, after the 1st event of the 1st event structure, the app is freezed and wait for action from the 2nd event structure. As I said this is not expected since the user should be able to make several events of the 1st event structure before triggering the 2nd event structure.

Both event strutcure are connected by a wire to pass the data.

I tried in options to unlock the panel but then the code inside the event structure does not work as it should.

The event is Mouse down which are may be not appropriate.

I am not so experienced in Labview, 1st time that I i use event structure.

Thanks for your help

0 Kudos
Message 1 of 7
(13,914 Views)

From LabVIEW Fundamentals:

 

Avoid Placing Two Event Structures in One Loop:

 

"..NI recommends that you place only one Event structure in a loop. When an event occurs in this configuration, the Event structure handles the event, the loop iterates, and the Eventstructure waits for the next event to occur. If you place two Event structures in a single loop, the loop cannot iterate until both Event structures handle an event. If you have enabled front panel locking for the Event structures, the user interface of the VI can become unresponsive depending on how the user interacts with the front panel..."

Message 2 of 7
(13,885 Views)

Hi Thanks for your support,

Each event structure has its own while loop

I could fixed my issue with appropriate handling of each while loop stop condition.

0 Kudos
Message 3 of 7
(13,882 Views)

To give you the most helpful responses, please do the following:

  • Tell us as clearly as you can what you want to do.  Don't tell us "how you think you should do it" (so don't even mention Event Structures).  If there are things that need to be done "in a certain order", be sure to explain that order to us.
  • If you have code that doesn't work, attach your code in a form that we can look at it, edit it (which sometimes means "clean it up, and straighten out all the wires"), and test it.  Because many of us (myself included) do not have the most recent versions of LabVIEW on our computers, please "Save for Previous Version" and specify LabVIEW 2019 or 2021.
  • By their very nature (to quickly respond to an "Event" without blocking other Events), one should "almost never" have more than one Event structure in a VI, handling all of the "Events" for that VI.  If we understand the "What" that you want to do, we can probably suggest "How" with a single Event structure

Bob Schor

Message 4 of 7
(13,878 Views)

Hello Bob,

Ok, here is what I have to do:

 

I want one button which allow to select one row of data from another array (database) and then fill another array with the selected data. The user should be able to repeat this action several times until he picked up all the desired data.

 

Then, I want that another button which call the array with selected data and treat it (means send via serial com to controller).

 

I hope it is now clear for you.

 

I choosed event structures which seems to be the most appropriate, but let me know if there better approach.

0 Kudos
Message 5 of 7
(13,871 Views)
Solution
Accepted by topic author MSIEV

Hi MSIEV,

 


@MSIEV wrote:

I want one button which allow to select one row of data from another array (database) and then fill another array with the selected data. The user should be able to repeat this action several times until he picked up all the desired data.

 

Then, I want that another button which call the array with selected data and treat it (means send via serial com to controller).


Ok, there are two buttons on your frontpanel.

And you created two loops with two events structures to access the data of the very same array???

 


@MSIEV wrote:

I hope it is now clear for you.


No: why do you need two loops and two event structure to handle two buttons?

Whats' wrong wiht ONE loop containing ONE event structure with two (or more) event cases?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(13,863 Views)

Hi

Quick update,

 

Finally I kept only 1 event structure in the VI for all the buttons.

It works as I expect.

Thanks

0 Kudos
Message 7 of 7
(13,779 Views)