Back to Adaptive Vision Library website
You are here: Start » Function Reference » Conditional Processing » MergeDefault
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Creates a non-conditional value from a conditional one by replacing Nil with the specified default value.
Syntax
void avl::MergeDefault ( const typename atl::ToConditionalType<const Type&>::Type& inConditionalObject, const Type& inDefaultObject, Type& outObject )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
inConditionalObject | const typename ToConditionalType<const Type&>::Type& | Input conditional object | ||
inDefaultObject | const Type& | Object to be used if the conditional object is empty | ||
outObject | Type& | Value of the conditional object, if it exists, or the default otherwise |
Description
This function is related to Conditional<T>. It receives a conditional value and:
- If it is Nil, replaces it with a specified default value.
- Otherwise, copies it to the output.
Hints
- Connect the conditional value to the inConditionalObject input.
- On the inDefaultObject input define a value that will be substituted for Nil on the inConditionalObject input.
- Also consider the coalescing operator (??) in Formula Blocks.
Examples
inConditionalObject = 5 inDefaultObject = 8 |
outObject = 5 |
inConditionalObject = Nil inDefaultObject = 8 |
outObject = 8 |
Remarks
This filter is a counterpart of the IFERROR function from Microsoft Excel.
This filter can replace the following formula:
See Also
- MakeConditional – Checks a condition. If the condition is True, then copies the input object to the output; otherwise returns Nil.
- MergeBranches – Chooses the first non-Nil object, or reports an error if there is no such object.
- MergeConditionals – Returns the first not-Nil input object.
- MergeIntoArray – Creates an array from not-Nil input elements.