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.
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.
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
@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
What about using a Literal Expression that returns all the outputs of the connected DMN tables?
@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
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
@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?
You could model a DRD like this:
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 DMN Decision Literal Expression | docs.camunda.org
Hope this helps a bit.
@felix-mueller, I tried it yesterday evening, and came to the same approach as you described 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
But I think, this approach is more suitable for my needs than using JavaDelegate. Thank you
@stanislav great to hear that you came to a similar result!
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.