Results from multiple DMN tables


#1

Hi there,
I would like to evaluate multiple decision tables in one Rule Task. I know about the DRD and chaining the DMN tables. But I don’t want to use results of one table as inputs into another. I need results from both tables to use later in the process. And I would like to avoid creating two Rules Tasks.
Ideally I would like to get results from both tables as a List/map in the variable defined in “Result Variable”.

When I tried it, only results from the main table (referenced in the Rule Task) were filled-in the “Result Variable”. Results from “Required table” were missing.

p.s. both tables have the same inputs, but different outputs. Hit Policy is Collect in both tables.

Thank you


#2

Hi @stanislav,

You can achieve this by implementing the business rule task as a JavaDelegate and call the DMN engine from your custom Java code as often as you need. Then you also have full flexibility of result processing.

Cheers,
Thorben


#3

Hi @thorben , thank you for the quick answer.
Yes, I am aware of that solution, but was curious if it could be solved only with the configuration. Based on your answer, I see it’s not possible. IMHO it would be a nice feature, because it allows you to use DRD for wider range of use-cases.

but thanks anyway


#4

@stanislav what about using a script in a script task?
Or is it possible to do a multi instance business rule and have the dmn a dynamic expression value pulled from the collection?
Something like this:
Pattern Review: DMN Looping for Array Input


#5

What about using a Literal Expression that returns all the outputs of the connected DMN tables?


#6

@StephenOTT , thank you for your suggestions.
I don’t want to use script task, when dealing with decision tables/rules. I would like to have clear convention, that allows users/analysts to easily read process diagrams. And for that, I need service task, always when calling back-end system, user task when calling front-end, and RuleTask when calling DMN table. No dual uses :slight_smile:
Regarding your pattern. I think for my case, using JavaDelegate for Rule Task would be more cleaner solution. But it’s an interesting approach you designed, and maybe I will use it later :slight_smile:


#7

@felix-mueller, it sounds interesting. But I don’t have much experience with Literal Expressions, and cannot find how to use them together with dmn tables in the documentation. Could you please elaborate a little bit more? Should I chain literal expression with my two dmn tables(make them required)? And then, should I refer to the Literal Expression from the Rule Task?

Thank you


#8

@stanislav
You could model a DRD like this:

In the Literal Expression using JavaScript or another Scripting language you have access to the outputs of the DMN tables.
You can then use the Generate Results Literal Expression within your Business Rule Task in the BPMN.
You will find some basic info regarding LE here https://docs.camunda.org/manual/7.7/reference/dmn11/decision-literal-expression/

Hope this helps a bit.

Best
Felix


Letting users exclude plan items
DRD with Literal Expression should collect messages
#9

@felix-mueller, I tried it yesterday evening, and came to the same approach as you described :slight_smile: One thing that will be a little bit difficult is to parse reasonable output from all the variables (columns from decision tables). But nothing that cannot be done :slight_smile:
But I think, this approach is more suitable for my needs than using JavaDelegate. Thank you


#10

@stanislav great to hear that you came to a similar result!


#12

Can we get only Output-cell name/value without using cell property in Leteral Expression using Groovy? I tried with binding.getVariables(), It returns inputCell and outputcell both. Help will be appreciated.