Start » Filter Reference » Data Flow » Conditional Processing » MergeBranches
Module: | FoundationLite |
---|
Chooses the first non-Nil object, or reports an error if there is no such object.
Name | Type | Description | |
---|---|---|---|
inConditionalObject1 | <T>? | First conditional input object | |
inConditionalObject2 | <T>? | Second conditional input object | |
inConditionalObject3 | <T>? | Third conditional input object | |
inConditionalObject4 | <T>? | Fourth conditional input object | |
inConditionalObject5 | <T>? | Fifth conditional input object | |
inConditionalObject6 | <T>? | Sixth conditional input object | |
inConditionalObject7 | <T>? | Seventh conditional input object | |
inConditionalObject8 | <T>? | Eighth conditional input object | |
outObject | <T> | First not-Nil input object |
The type of this filter is defined using the type variable T which represents any valid type. Read more.
Description
The operation collects a number of conditional objects and passes the existing input values onto the outObject output. The filter assumes that at least one of the input values exists; otherwise an error with appropriate description occurs.
The operation is similar to the MergeConditionals filter, yet it computes the proper (non-conditional) object.
Hints
- Also consider the coalescing operator (??) in Formula Blocks.
- This filter creates a full copy of one of the input objects. Thus, if you need the highest possible speed, use this filter only with primitive types. An alternative is to use Variant Step macrofilters which are fast and elegant.
Examples
inConditionalObject1 = Nil inConditionalObject2 = Nil inConditionalObject3 = "Mike" inConditionalObject4 = "Alice" inConditionalObject5 = Nil inConditionalObject6 = "Joanne" inConditionalObject7 = Nil inConditionalObject8 = Nil |
outObject = "Mike" |
inConditionalObject1 = Nil inConditionalObject2 = Nil inConditionalObject3 = Nil inConditionalObject4 = Nil inConditionalObject5 = Nil inConditionalObject6 = Nil inConditionalObject7 = Nil inConditionalObject8 = Nil |
Error occurs. |
Errors
This filter can throw an exception to report error. Read how to deal with errors in Error Handling.
List of possible exceptions:
Error type | Description |
---|---|
DomainError | All of the conditional objects on input are Nil in MergeBranches. |
Complexity Level
This filter is available on Expert Complexity Level.
See Also
- MergeConditionals – Returns the first not-Nil input object.
- MergeIntoArray – Creates an array from all the non-Nil input elements.