06-13-2012 07:28 AM
Hi,
How topic title, i need to know how change at run-time the type of a step. I have, i my sub-sequence, a step whose type must change at run-time based upon the occurrence of a condition. How can do it?
Thanks.
06-13-2012 10:39 AM
There is a StepType sub property but it is Read Only. You may have to delete the step and place a new step with the desired type.
06-13-2012 04:16 PM
I will try how you said just when i have one moment free,
Thanks
06-14-2012 09:15 AM
There is a method called ChangeStepType on the step object.
I have no idea what the consequences are of doing this at runtime. You should check the Step.CanChangeStepType property first and make sure it's true before doing it. Use at your own risk.
06-14-2012 09:44 AM - edited 06-14-2012 09:45 AM
Writing self-modifying sequences is not recommended. If multiple threads are running the same sequence at the same time you will need to use locks or some other mechanism of synchronizing the edits and execution of the step so that two or more threads aren't trying to do it in parallel. Also you might want to disable the sequence property "Optimize non-reentrant calls" since that will likely not work correctly since it will be trying to use a cached copy of the sequence whenever you call the sequence, yet the cache might be out of data since it wasn't expecting you to modify the sequence while it was running.
It might work, but there might also be a better way to do it. If you explain exactly what you are trying to do, it's possible we might be able to suggest some alternatives.
Hope this helps,
-Doug
06-15-2012 01:30 PM
I need to do this: At verify of a condition, one specific step at the end of sequence must change from statement to numeric limit test and viceversa.
However, is right to no writing self-modifyinf sequence unless handle rece condition on step that i want change at run-time.
Moreover i ask myself: If for change the type of a step i need first delete the substep and later create a new one relative to the step that I want, then it is better and make more sense to create dynamically the step that i would like to have depending on the condition that occurs, right?
Thanks
06-15-2012 01:47 PM