property( bean, nameOfProperty, valueIfMissing )
This function extracts a bean's property under a given key name (the nameOfProperty
parameter).
See also: index(): This function acts as an alias to the property()
function especially when applied over custom data types.
Keyword | Type | Description |
---|---|---|
|
Bean |
Bean to retrieve the property from. |
|
Text |
Property to retrieve from the bean. |
|
Any Type |
Default value to return if the property is not present in the bean. |
Any Type
If the named property is not present, then the value for the valueIfMissing parameter is returned instead.
The value type of the valueIfMissing parameter should be the same type as the expected property’s type.
For example, property(msg!properties,"someStringProperty","Missing Text")
returns "Missing Text"
if someStringProperty
does not exist.
When the bean is a dictionary, if the nameOfProperty is not found in the dictionary, the valueIfMissing will be ignored and a null value will be returned. Consider using a map instead of a dictionary.
You can copy and paste these examples into the Expression Rule Designer to see how this works.
property(msg!properties,"name","no name was sent")
returns no name was sent
when the name
property is not received in a message.
Feature | Compatibility | Note |
---|---|---|
Portals | Compatible | |
Offline Mobile | Compatible | |
Sync-Time Custom Record Fields | Compatible | Can be used to create a custom record field that only evaluates at sync time. |
Real-Time Custom Record Fields | Incompatible | Custom record fields that evaluate in real time must be configured using one or more Custom Field functions. |
Process Reports | Incompatible | Cannot be used to configure a process report. |
Process Events | Incompatible | Cannot be used to configure a process event node, such as a start event or timer event. |
property() Function