Programmatically change DMN rules

Hi,

I have some questions regarding the dmn-js modeler.
I do need to programatically manipulate the rules within a dmn table.
More precisely, I need to perform the following manipulations:

  • Delete all rows (column definitions should remain)
  • Read out column names and perhaps types
  • Insert new rows

I am used to do bpmn manipulations with the bpmn modelers services “modeling” and “commandStack”. Is there something similar for dmn-js that would allow me to do the actions needed?
The only thing that I could find so far is exporting and importing the whole a whole XML. I think it would be possible but extremely inconvenient to use that route.

In dmn-js you’ll find a very similar API: https://github.com/bpmn-io/dmn-js/blob/develop/packages/dmn-js-decision-table/src/features/modeling/Modeling.js

The only difference is that you’d need to get the currently active editor first (since there are multiple):

const decisionTable = dmnJS.getActiveViewer();

const modeling = decisionTable.get('modeling');

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.