Pattern Review: DMN Looping for Array Input

  1. Json value is the variable that is updated in each iteration of the multi-instance. Look at the BPMN files and see the listeners on the multi-instance.

  2. Values is just a generic property name i used within the json. Each object result of the mulit-instance integration is added into the json in the “values” property’s array.

  3. combined result is a json variable that is updated on each iteration. See the listeners as discussed above.

  4. See the DMN file and the dmn_output variable. It is a map that is result and navigated. Remember that this is navigated as Java with the Jackson helpers on top. So you need to look at the cockpit and understand the types that are being saved in the DB and being returned to

The code snippet of

var combinedResult = execution.getVariable("combinedResult");
var dmn_output = execution.getVariable("dmn_output")["user"];

combinedResult.prop("values").append(dmn_output)

execution.setVariable("combinedResult", combinedResult)

is doing:

  1. get the combined result variable which holds the current aggregated result of all executed instances
  2. get the user value from the DMN result (the output of the DMN was saved into the dmn_output variable).
  3. inside of the combinedResult variable in the “values” property, we apparent the dmn_output user value into the array.
  4. We re-save the new variable which overwrites the previous version of the combined result variable.