Literal Expression: Iterate through output entries of the preceding DMN-Table

Hey everyone,
currently i have two DMNs which i want to merge into a single Decision Requirements Graph with two DMN-Tables.
Now I have a DRG like this with two DMN-Tables and a Literal Expression:

The First DMN looks like this:

The second DMN looks like this:

The first DMN produces a Map which has to be mapped into a list as an input for the second DMN Table.

In the Literal Expression i want to iterate over all the output entries, check if they’re set to “true” and put them in the shopping list.

How can i iterate over the outputs of the first DMN table in the context and how do i save them in a list so the second DMN table can access it?

I have browsed through the whole Reference and Samples at Get Started | FEEL-Scala

So far i have thought of something like:

for grocery in get entries(dmnOutput)
return if (grocery.value) then grocery.key else null

But then again there is no variable “dmnOutput” in the context.

Hi @DavidZang ,

please have a look at this:

FEEL offers filter functions for lists. You can use them to achieve what you have in mind.

Also, I would recommend to change the structure of the first DMN to this:

I think you would not need to have an expression then.

I hope this helps


Hey @jonathan.lukas ,

thanks a lot for the quick reply :smiley:

This DMN is just a minimal reproducable example. Imagine instead of having 2 rows and 2 columns, the table would have a couple of hundred rows and 30 - 60 columns. If i hacked all of these values into one cell, the business people would lose overview. At all times by looking at the table they need to be able to answer the hypothetical questions:

  • Which of the ~60 items need to be bought on a monday?
  • On which of the multiple hundred days (i know there is only 7 Days of week, so probably my example is not a perfect fit :smile: ) do i need to buy Orange Juice

Maybe this would be a great way to simplify the “if…then” part but in order to filter a list i need to have access to a list first:

  1. I suspect the preceding DMN has a Map and not a List as an output, which would probably make it impossible to use the list filter function
  2. I do not even know how to access this map because i do not know the variable name?

So my question is: How do i access/dereference/get the results from the first DMN-Table in the Literal Expression? How do i know the variable name that i have to call?

Or as a first step to improve debugging: Is there a way to log or list or get all variables so i know which ones are available in the context of the literal expression?

Hi @DavidZang ,

well this is quite some data. On the other hand, is having 30 to 60 columns really more of an overview?

Question 1 can be answered by using the DMN simulator for example :slight_smile: .
Question 2 can be answered by having a look at the table as the input params are listed in a OR-logic.

My thought here was of course that we are actually talking about a business rule with a very limited range of input values, so I will stop and come back to your rule structure :stuck_out_tongue: .

The output of your first table would provide you with a Map, that is correct. This map is available in the context by the individual column names, not as one context object.

Maybe a mix of the solutions serves here:

Does this help?


Hey @jonathan.lukas ,

thanks again!

I would say, having individual columns provides more of an overview to see on which days you would have to buy oat.
If you put them into one output column, there is no way to search or filter the rules which contain “Oat” in Camunda Modeler or dmn-js (except in XML-View).

If there is no way of iterating over all the DMN-Outputs in a literal expression, I’m still thinking about adopting your solution. But then I would have to provide some way for the business people to search or filter the hundreds of rows for occurences of “Oat” by providing a search- or filter-extension to dmn-js.

Do you have any suggestions?