Zero, Unset, Boolean, Drop, Null and Exists Functions ----------------------------------------------------- .. index:: Macro function;fn.zero .. index:: Macro function;fn.unset .. index:: Macro function;fn.true .. index:: Macro function;fn.false +----------------+----------------------------+---------------------------------+--------------------+ | Function | Description | Example | Output or Result | +================+============================+=================================+====================+ | | | :: | :: | | | | | | | fn.zero | Return a zero value. | {{fn.zero}} | 0 | +----------------+----------------------------+---------------------------------+--------------------+ | | | :: | :: | | | | | | | fn.unset | Return an empty string. | {{fn.unset}} | '' | +----------------+----------------------------+---------------------------------+--------------------+ | | | :: | :: | | | | | | | fn.true | Return a boolean True. | {{fn.true}} | true | +----------------+----------------------------+---------------------------------+--------------------+ | | | :: | :: | | | | | | | fn.false | Return a boolean False. | {{fn.false}} | false | +----------------+----------------------------+---------------------------------+--------------------+ Given input context: 1. ``{"input": {"field1": {"key1": "value1"}}}`` 2. ``{"input": {"field1": None}}`` 3. ``{"input": {"field1": ""}}`` .. index:: Macro function;fn.is_none_or_empty +---------------------+-------------------------------------------------------------+--------------------------+------------------+ | Function | Description | Example | Input and Result | +=====================+=============================================================+==========================+==================+ | fn.is_none_or_empty | Return a boolean if the argument is None or an empty string | :: | input 1. | | | | | | | | | | :: | | | | {{fn.is_none_or_empty | | | | | input.field1}} | false | | | | | | | | | | input 2. | | | | | | | | | | :: | | | | | | | | | | true | | | | | | | | | | input 3. | | | | | | | | | | :: | | | | | | | | | | true | | | | | | +---------------------+-------------------------------------------------------------+--------------------------+------------------+ Given input context: :: { "input": { "test": null } } .. index:: Macro function;fn.null +----------------+----------------------------+---------------------------------+--------------------+ | Function | Description | Example | Output or Result | +================+============================+=================================+====================+ | fn.null | Returns Null. Useful in | :: | :: | | | comparison tests. | | | | | | (( input.test == | true | | | | fn.null )) | | | | | | | +----------------+----------------------------+---------------------------------+--------------------+ .. index:: Macro function;fn.drop .. index:: Macro function;fn.force_null Useful in Configuration Templates: +----------------+----------------------------+----------------------------------+--------------------+ | Function | Description | Example | Output or Result | +================+============================+==================================+====================+ | | | :: | | | | | | | | fn.drop | Removes the attribute | {'name': | Attribute dropped | | | | '{{fn.drop}}'} | | | | | | | +----------------+----------------------------+----------------------------------+--------------------+ | | | :: | :: | | | | | | | fn.force_null | Attribute has Null value | {'name': | {'name': None} | | | | '{{fn.force_null}}'} | | | | | | | +----------------+----------------------------+----------------------------------+--------------------+ Example of ``fn.drop`` in an if-then-else test from a Configuration Template of a workflow. the attribute is dropped if not entered as input: :: "ldapDirectoryName": "(( input.cucm_user_ldapDirectoryName != '' )) <{{ input.cucm_user_ldapDirectoryName }}> <{{ fn.drop }}" .. index:: Macro function;fn.exists Given input context: 1. ``{"input": {"field1": {"key1": "value1"}}}`` 2. ``{"input": {"field1": {"key1": null}}}`` 3. ``{"input": {"field1": ""}}`` +-----------+---------------------------------------+----------------------------+------------------+ | Function | Description | Example | Input and Result | +===========+=======================================+============================+==================+ | fn.exists | Return a boolean true if the argument | :: | input 1. | | | is exits and has a non-null value. | | | | | | | :: | | | | {{ fn.exists | | | | | input.field1.key1 }} | true | | | | | | | | | | input 2. | | | | | | | | | | :: | | | | | | | | | | false | | | | | | | | | | input 3. | | | | | | | | | | :: | | | | | | | | | | false | | | | | | +-----------+---------------------------------------+----------------------------+------------------+ | | | | input 1, 2, 3 | | | | | | | fn.exists | If the *argument does not exist*, it | :: | :: | | | is interpreted as a string - which | | | | | is interpretable, so the function | {{ fn.exists | true | | | returns true. | field.key }} | | | | | | | +-----------+---------------------------------------+----------------------------+------------------+ .. |VOSS-4-UC| replace:: VOSS-4-UC .. |Unified CM| replace:: Unified CM