FEEL

FEEL context functions

5 built-in functions · DMN 1.6

Functions over FEEL contexts, the key/value records written as {name: value, …}. They read entries dynamically and build modified copies without mutating the original.

All FEEL context functions at a glance

FunctionSignatureReturns
get valueget value(context, key)Returns the value of the named entry, or null if the key does not exist
get entriesget entries(context)Returns the context as a list of {key, value} pairs, enabling iteration over entries
contextcontext(entries)Builds a context from a list of {key, value} pairs, the inverse of get entries
context putcontext put(context, keys, value)Returns a copy of the context with the entry set, added or replaced
context mergecontext merge(contexts)Combines a list of contexts into one; later entries overwrite earlier ones with the same key

Function reference

Each function with its parameters, examples and edge cases.

get value

get value(context, key)

Returns the value of the named entry, or null if the key does not exist. Useful when the key is only known at runtime.

ParameterTypeDescription
contextcontextthe context to read
keystringthe entry name
get value({foo: 123}, "foo")
get value({foo: 123}, "bar")

Related: get entries · context put

get entries

get entries(context)

Returns the context as a list of {key, value} pairs, enabling iteration over entries.

ParameterTypeDescription
contextcontextthe context to expand
get entries({foo: 123, bar: 456})
[{key=foo, value=123}, {key=bar, value=456}] Try it ↑

Related: get value · context

context

context(entries)

Builds a context from a list of {key, value} pairs, the inverse of get entries.

ParameterTypeDescription
entrieslist of contextsa list of {key, value} pairs
context([{key: "a", value: 1}, {key: "b", value: 2}])
{a=1, b=2} Try it ↑

Related: get entries · context put · context merge

context put

context put(context, keys, value)

Returns a copy of the context with the entry set, added or replaced. A list of keys addresses a nested entry path.

ParameterTypeDescription
contextcontextthe source context
keysstring or list of stringsentry name, or a path of names for nested contexts
valueanythe value to set
context put({x: 1}, "y", 2)
{x=1, y=2} Try it ↑
context put({x: {y: 1}}, ["x", "y"], 2)
{x={y=2}} Try it ↑

Related: context merge · get value

context merge

context merge(contexts)

Combines a list of contexts into one; later entries overwrite earlier ones with the same key.

ParameterTypeDescription
contextslist of contextsthe contexts to combine, in order
context merge([{x: 1}, {y: 2}, {x: 3}])
{x=3, y=2} Try it ↑

Related: context put · context

How B-FEEL differs

In standard FEEL an invalid argument makes the result null. The business-friendly B-FEEL dialect returns a type default instead. Both columns were evaluated by the same engine:

ExpressionFEELB-FEEL
get entries(null)null[]
{a: 1}.b + 1null1

More FEEL guides

FEEL string functions · FEEL numeric functions · FEEL list functions · FEEL date and time functions · Language constructs · Examples cheat sheet

Defined by the OMG DMN 1.6 specification, chapter 10.3.4 (built-in functions).