jbpmdmnfeel-language

DMN model rule that can loop custom data type list


I have a data structure similar to below json example and I would like to loop through nested list to get "DetailType" , check if a single "DetailType" is "ABC" then don't check rest of the Accounts and return true. How can this be modeled in DMN. Basically if customer has a single account that has "DetailType" = "ABC" then its a valid customer.

"Customer Profile" : {
  "customer" : {
    "customerName" : "gjhjhkj",
    "Accounts" : [ {
      "Number" : "pWYSk93jiL",
      "accountDetails" : [ {
        "DetailDesc" : "sdfdsff",
        "DetailType" : "4354355435",
      }, {
        "DetailDesc" : "Mr7GQRzcc0",
        "DetailType" : "JERV3kQZFR",
      }
    } ]
  }
}

Solution

  • Using FEEL, you could write something along the lines of:

    some DetailType in Customer Profile.customer.Accounts[accountDetails][DetailType] satisfies DetailType = "ABC"
    

    but the question as it was originally posted is missing to show on any attempt to do it with an example DMN, so there are a lot of other requirements which need clarification to provide a full working solution.

    Definitely the expression above is a valid FEEL expression which address the question as originally posted.