FEEL context functions

5 built-in functions · DMN 1.6

A FEEL context is a record: named entries written as {name: value}. Most of the time you read one with a path such as customer.age. The context functions cover the cases a path cannot: a key that is only known at runtime (get value), iterating over the entries (get entries), and building a changed copy (context put, context merge). None of them modifies the original context.

Each result below was computed by the engine that runs the playground. Context literals and path access are explained in the guide to lists, filters and contexts.

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(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")
returns 123 Try it ↑
get value({foo: 123}, "bar")
returns null Try it ↑

Related: get entries · context put

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})
returns [{key=foo, value=123}, {key=bar, value=456}] Try it ↑

Related: get value · 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}])
returns {a=1, b=2} Try it ↑

Related: get entries · context put · context merge

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)
returns {x=1, y=2} Try it ↑
context put({x: {y: 1}}, ["x", "y"], 2)
returns {x={y=2}} Try it ↑

Related: context merge · get value

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}])
returns {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

Every result on this page was computed by the Impulse FEEL engine 0.9.1, the interpreter that runs the playground. Last updated .

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