I’m dealing with a c# component in VisualStudio. I was wondering if there is a method or procedure to set output of a component several times during a script. As a very simple example imagine there is a loop testing a condition inside the script and each time the condition is met, the component output sets to True, otherwise it outputs False, so the output changes between False and True while component is processing and is not waiting for the whole process to be done and then set the output.
You can set the outports at any time in your code, even in loops. But downstreams objects will only see the last value, since the value is made available to the outer world only after the component/solution has finnished.
Assuming that this is not what you want, you should let the component run once for every step in the loop, keeping the iteration index number between runs in a class lever variable, and so keep re-running the component until your loop.Count is reached. This is slow though, compared to an internal for-loop.
Search for “ExpireSolution” in this forum for numerous examples of how to write such a loop.
A better solution may be to make a list of your results, one item per step in the foor-loop, and analyse the list after the component has finnished.
thank you Rolf for the reply, the “ExpireSolution” solution is the method I was looking for.
Perhaps you may find the solution which I recently posted in the anther post being useful.