
Key: DMN12223

Status: closed

Source: Red Hat ( Edson Tirelli)

Summary:
Iteration is supported in DMN1.1 using the for..in..return operator, such as
for j in myList return myFunction(j,…)
But this only handles the case where each iteration of myFunction depends only on the value of j, the nth item in myList. It excludes cases where the iteration depends on:
1. The n1st item in the list, or
2. The nth item of another list, or
3. The result of the n1st iterationThese are all very common iteration use cases.

Reported: DMN 1.1 — Thu, 4 Jan 2018 14:46 GMT

Disposition: Resolved — DMN 1.2

Disposition Summary:
add iteration context and 'partial' keyword to for..in..return
Proposal
The solution requires two simple enhancements to the for..in..return operator.
1. Loop on index. Following “in”, instead of the list variable myList use the range syntax a..b, where expressions a and b are integers, for example:
for n in 1..N return myFunction(n, myList,…)
Most often N will be the count of myList and n an index into myList:
for n in 1..count(myList) return myFunction(myList[n],…)
2. Include partial results in the iteration. Much like the builtin variable item is defined for filter expressions, we introduce a new builtin variable partial for iteration, a list variable holding the results of previous iterations, for example:
for n in 1..N return myFunction(n, myList, partial, …)
Typically this would be used in an expression like
for n in 1..count(myList) return myFunction(myList[n], partial, …)
These two small changes allow for..in..return to handle all 3 iteration use cases.

Updated: Wed, 3 Oct 2018 14:17 GMT

Attachments:
 DMN12223_proposal_v3.docx 83 kB (application/vnd.openxmlformatsofficedocument.wordprocessingml.document)
DMN12 — Limitations of FEEL for..in..return
 Key: DMN12223
 OMG Task Force: Decision Modeling and Notation 1.2 RTF