Hello,
I want to define a DMN rule that evaluates against a complex object array. I wrote my rules with FEEL until now and find it to be readable enough so I like it. But I can’t wrap my head around how to handle complex object arrays. So the array with complex objects is quite simple actually:
[
{
"policyId": "13493345",
"title": "sometext",
"roles": [
{
"partyId": 12345,
"role": "PolicyHolder"
},
{
"partyId": 349834,
"role": "Payer"
}
]
}
]
So we can ignore the outer “policy” array as for now I only ever expect to be a single policy present:
policy[1]
will do that. But inside this policy he have a list of roles. What I need to do is find the role that has the property “role”: “policyHolder” - but then I want to actually compare the partyId property of the same object to some other variable from the decision table.
Something like (pseudo code):
policy[1].roles[“role” = “policyHolder”].partyId = someOtherIntVariable
FEEL seems to only able to work with basic values but I also read you might be able to use Spin within FEEL to do some basic JSON transformations - but I can’t seem to find a way to get this working and I’m also unable to find examples.
From other posts it looks like using JavaScript would be my best option as the expression language but on the other hand I feel in that case I might as well just write more complex code in external workers in the first place.
Does anybody has any ideas how to handle this in an as simple/understandable as possible way?
Thanks!