In a state machine made with SCXML, is there any way to set a dynamic target value for a transition?
I mean, suppose I have an object called "obj" which has been set as the datamodel for a scxml. So there can be set conditions (if there were a property called checkCondition in the object) on it like:
cond="obj.checkCondition"
<state id="state1">
<transition cond="obj.checkCondition" target="state2"/>
</state>
<state id="state2">
...
</state>
I have another property in obj called nextTarget. I want to set the target in this transition reading its value from the object (as it is done in the conditions).
<state id="state1">
<transition cond="obj.checkCondition" target="eval(obj.nextTarget)"/>
</state>
<!-- Where in obj.nextTarget there it has been set as value "state1", "state2" or any state name -->
Is there any syntax to do this?
Thanks.
Although the answer of @Charles Goodwin is pretty acurate... I may add my words. To simplify:
You are sheerly hiding the logic of the problem.
What you should have: several transitions
and the process which would have dynamically set the target in your design, will dynamically process the event for my_transition_A or my_transition_C... just like it would have chosen the target_state in your design).