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.
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.
05-30-2012 09:23 AM
Whenever I make a state machine, I feel like there is some redundancy in the way I program the final "complete" state.
Attached is an image of the final two states in my state machine. There is a user dialog that asks if you want it to keep going or if you are finished. It then sends the string to go to the "complete" case. My question is if the "complete" case ever actually runs, or if I can get rid of that case entirely. (I feel it is kind of redundant because I pass the "complete" string out of the "complete" state, even though I am not running that case multiple times)
I ask because I am thinking about putting some general formatting code in that comlpete case if I can, but I can always just add in another state if I have to.
Solved! Go to Solution.
05-30-2012 09:41 AM
I would keep it. Just in case you need to add some "completion code" some time
05-30-2012 09:44 AM
That is my question though, that "complete" case does run? It is not skipped over when it registers that complete=complete in the beginning?
05-30-2012 09:46 AM
Your complete case will execute. However, I would put the boolean for stopping the state machine inside your complete case itself. By doing this you could possibly use different cases to exit your state machine if your require different porcessing depending on what triggered the stop. It is also easier to maintain since you cold change the name of your exit state and not have to update the extra check outside the case.
05-30-2012 11:30 AM - edited 05-30-2012 11:33 AM
As Mark was saying, do something like this.
05-31-2012 10:11 AM
JUst thought I would add your Exit state cound evolve into something like this...