LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure cancellation

Solved!
Go to solution

Hi,

Hope you are all keeping well,

I am struggling with an even structure coding in which I am looking for to cancel the entry  in string if am at String 1 and cancel the entry in String & String1 when I am at String 2. Basically what I designed is after triggering START, string will allow to feed, once it is done it will allow to feed in string1 , and then string 2. If I would like to cancel any entry at any point of time by triggering cancel button. Attached is coding I am trying with which I am not successful so far.

 

Any help much will be much appreciated. 

0 Kudos
Message 1 of 6
(1,520 Views)

I DO NOT recommend that you have so many event structures in a single VI.  That you have event structures trapped inside of case structures is going to cause a lot of problems.

 

Read Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2016 Help

 

I don't know what you mean exactly by "cancel" an entry or what you are doing with your "allow to feed".  And once you progress through your VI, what do you with all this data you entered into these strings?

 

You should flatten your VI a bit.  Have a single while loop.  Set up a state machine so you know what part of your process you are in.  Have a single event structure that acts on every event in a "wait for user input" state.  Decide what to do next based on your current state and what event the user triggered.

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

Hi,

 

Thanks for your quick reply,

 

By saying "cancel"  I mean if you made any entry in string ( in the front panel)  and you want to cancel that entry , then I had given a cancel button to remove the entry in the string and to allow a new entry and  same if I found entry in the string 2 found wrong then I would like to cancel both entry in string & string 1 and to allow new entry.  Hope you got my requirement.

 

As you said going with a state machine will be able to do what I want , but I wonder why it is not working with an Event structure 

 

Thanks for the link on events, I hope I will get something from that.

0 Kudos
Message 3 of 6
(1,487 Views)

I agree that your code makes very little sense and there are all these silly little things.

 

  • Since you are iterating over a diagram constant, "Exit" can never happen.
  • "Untitled 1.vi" is a really (really!) poor choice for a file name, especially when attaching here.
  • Have you ever wondered what would happen if you would remove that little case structure inside the FOR loop and just wire across? (Hint: everything will continue to work as before)
  • How many times do you think you need to make e.g. the cancel button visible? It is never invisible!
  • All your string controls should be set to "limit to single line" so you can complete an entry with <enter>.
  • It is a really (really!) bad idea to trap even structures inside case structures.
  • The main reason you seem to need to reset your latch action buttons is because they are not in the dataflow and only get read once at the start of the program.
  • Why do you have such an exotic mix of mechanical action settings for your various buttons?
  • You have way too much code for such a simple task. Go back and design a clean state machine. One while loop, one event structure, no queue, no property nodes, correct mechanical actions, etc.

 

0 Kudos
Message 4 of 6
(1,446 Views)
Solution
Accepted by topic author rajeevan@1978

See if this can give you some ideas....

 

 

0 Kudos
Message 5 of 6
(1,434 Views)

Hi,

 

it was nice to see a perfect solution which I was looking for before I went for holidays even though I made my application run as I want in a cumbersome way of coding. 

 

Thanks for your time and effort for this solution. 

0 Kudos
Message 6 of 6
(1,382 Views)