serial
Short summary
Method to perform a given action on all objects inside the collection.
Objects are invoked with the applier in order until done, only then is the next invoked.
Order is defined by the default iterator.
If at any point the applier returns an error the foreach stops and returns an error.
Action to perform needs to implement :ref:IApplier.
*Attention: This method is single cycle, what means the call waits for all appliers to finish. Therefore none of the appliers should wait for anything (Events/IO/...)
Example:
You have a list of numbers: 1 2 3 and a ConcreteIncrementApplier that can take a number and increment it.
Calling list.forEach(ConcreteIncrementApplier) will increment all numbers in the list, becoming: 2 3 4.
Return: SUCCESS: Alle appliers returned with SUCCESS
ERROR: The applier returned error for at least one object, or any other error occured
- Return type: CNM_ReturnTypes.SingleExecutionResult
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| applier | IApplier | the applier to be used on all objects | input |
Code
Declaration
METHOD serial :CNM_ReturnTypes.SingleExecutionResult
VAR_INPUT
(*the applier to be used on all objects*)
applier :IApplier;
END_VAR