redhatrulesdmndecision-model-notation

Business Central call a DMN file from another DMN


I am using RedHat Business Central and trying to call one DMN file from another.

Use case - if salary > 40000 then calculate Tax from firstdmn else from seconddmn.

enter image description here

I have added a context and literal expression in the Tax DMN decision and included a model below. But Don't know how to proceed further. Please suggest what to do.

enter image description here


Solution

  • Use case - if salary > 40000 then calculate Tax from firstdmn else from seconddmn. [...] But Don't know how to proceed further. Please suggest what to do.

    Here is an example using Red Hat Business Central, the Drools DMN open source engine and Scenario Simulation. Also this example is making use of best practices from DMN methodologies advising for Import and re-use of Business Knowledge Model nodes (or alternatively Decision Services)

    Starting with a skeleton of the model as partially suggested you suggested:

    step1

    In this model, we defined a BKM for a function that calculates Tax as 20% (mnemonic: this is the first DMN model, so ten percent). This is represented with the BKM called Tax10.

    Then we define in the second DMN model, a BKM for a function that calculates Tax as 20% (mnemonic: second DMN model, twenty percent): step2

    We go back to the first DMN model, and we Import the second one we just defined: step3

    We can now include the imported BKM from the second model, into the DRG: step4

    Now the FEEL literal expression matches your original requirement: step5

    We can use Scenario Simulation to verify, test and non-regression test the requirements: scesim

    This is as expected, when salary is above 40K we used Tax10, else from second model we used Tax20.