Zero, Unset, Boolean, Drop, Null and Exists Functions¶
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:
{"input": {"field1": {"key1": "value1"}}}
{"input": {"field1": None}}
{"input": {"field1": ""}}
Function | Description | Example | Input and Result |
---|---|---|---|
fn.is_none_or_empty | Return a boolean if the argument is None or an empty string | {{fn.is_none_or_empty
input.field1}}
|
input 1. false
input 2. true
input 3. true
|
Given input context:
{
"input": {
"test": null
}
}
Function | Description | Example | Output or Result |
---|---|---|---|
fn.null | Returns Null. Useful in comparison tests. | (( input.test ==
fn.null ))
|
true
|
Useful in Configuration Templates:
Function | Description | Example | Output or Result |
---|---|---|---|
fn.drop | Removes the attribute | {'name':
'{{fn.drop}}'}
|
Attribute dropped |
fn.force_null | Attribute has Null value | {'name':
'{{fn.force_null}}'}
|
{'name': None}
|
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 }}"
Given input context:
{"input": {"field1": {"key1": "value1"}}}
{"input": {"field1": {"key1": null}}}
{"input": {"field1": ""}}
Function | Description | Example | Input and Result |
---|---|---|---|
fn.exists | Return a boolean true if the argument is exits and has a non-null value. | {{ fn.exists
input.field1.key1 }}
|
input 1. true
input 2. false
input 3. false
|
fn.exists | If the argument does not exist, it is interpreted as a string - which is interpretable, so the function returns true. | {{ fn.exists
field.key }}
|
input 1, 2, 3 true
|