08-20-2008 04:09 PM
08-21-2008 07:22 AM
Guenter,
maybe you should tell us what you are up to since i think there is a more elegant way to solve your requirement.
Nevertheless, you can always check the Caller.RunState.LoopIndex in order to evaluate if you have reached the last iteration. This only works if your loop index is RunState.LoopIndex.
You have to get the upper limit of loops in a different way and i highly recommend you NOT to use a fixed number of loops (since you have to enter the number in the ste/loop as well as in the callback. Changing one instance will lead to a functionality which might be considered a bug in your sequence!)
hope this helps,
Norbert
08-21-2008 02:24 PM
08-22-2008 02:08 AM - edited 08-22-2008 02:10 AM
Guenter,
well, the way i discripted IS the generic way. The reason for this is the following:
You can compare TestStand very well with procedural programming languages. So you have variables with different lifetimes and scope. RunState is one variable, which is available in every scope, but it may have different content.
So you leaving the execution of your clientsequence in order to call the callback, you leave the scope of the RunState from your clientsequence. But only there the information is stored on how many iterations are left. It does not make sense to pass this anywhere, since the execution of your clientsequence has to decide if to loop further or not.
But, please note that there are different scopes for the "disable result recording" as well. You have found the most global one, the station option. But you can as well set this in the sequence settings (Edit >> Sequence Properties >> Disable Result Recording for All Steps) and at step-level (Run Options >> Record Result {uncheck it}).
Looping on a single step using the step settings, you can additionally choose not to record results for each iteration. This will lead to only a single entry in the ResultList, the overall result of the looped step (if resultcollection is enabled of course!).
hope this helps,
Norbert
08-22-2008 01:09 PM
08-29-2008 06:27 PM
Hi Guenter,
You mention that the reason you are doing this is to gather step results and you are interested only in the last itereation if a step looped.
Is there a reason we can't use a variable to store this? What I mean is everytime the step runs, save the result to a local variable. If the step iterates, then it simply overwrites the local variable with the new result.
If you are trying to write these to an array, one element for each step, another option is to use the Caller.RunState.LoopIndex.
Basically, if LoopIndex > 0, then you know that the step is iterating and you overwrite the last element in the array.
If LoopIndex = 0, you know we are on a new step and you add a new element to the array.
For looping steps, the array will still have the result of the last iteration because we kept writing over that step's element.
08-30-2008 06:16 AM
Thanks for your answer, Jervin.
You are right with your idea concerning the use of a variable to store the results. In fact, we go one step further and write to a file (I forgot to mention in my posts that we are writing to a file). It would be very ugly to parse the file every time a step has executed and manage the entries of steps that are configured to loop ... and also introduces a waste of time ... ugly, ugly ugly.
I see that we have to take the "next step" and customise the process model (which we have not done right now - therefore my approach to do it in that EngineCB). That will make live much easier and do it the "TestStand way".
Guenter