Camunda 7 DMN Feel Expression

Hi in camunda 7 dmn. I have a variable b as List with data

[
{
“progressStatusId”: 1690,
“progressStatusDesc”: “B”,
“progressStatusValue”: “C”,
“productLevel1”: “MNHD”,
“productLevel2”: “MNH1”,
“productLevel3”: "MNH10059 ",
“productLevel1Desc”: “G”,
“productLevel2Desc”: “S”,
“productLevel3Desc”: “W”
},
{
“progressStatusId”: 1691,
“progressStatusDesc”: “X”,
“progressStatusValue”: “1”,
“productLevel1”: “MNHD”,
“productLevel2”: “MNH1”,
“productLevel3”: "MNH10059 ",
“productLevel1Desc”: “G”,
“productLevel2Desc”: “S”,
“productLevel3Desc”: “W”
}
]

And then I have variable c as List of string with data [“1690”]
I want to ask how to filter variable b using feel expression with progressStatusId that contain in list c
After filtered b variable will only remain

[
{
“progressStatusId”: 1690,
“progressStatusDesc”: “B”,
“progressStatusValue”: “C”,
“productLevel1”: “MNHD”,
“productLevel2”: “MNH1”,
“productLevel3”: "MNH10059 ",
“productLevel1Desc”: “G”,
“productLevel2Desc”: “S”,
“productLevel3Desc”: “W”
}
]

Hi @Mason_John

The following FEEL expression should achieve the desired result:

(for x in b, y in c return if (x.progressStatusId = number(y)) then x else null)[item != null]

Note: The number(y) conversion function is used to transform string elements in list c into numeric values, as progressStatusId is of numeric type.

@hassang thanks for responses. You’re always helpful. I’m trying now.

1 Like

@hassang I need your help one more time for example if data had filtered to
[
{
“progressStatusId”: 1690,
“progressStatusDesc”: “B”,
“progressStatusValue”: “C”,
“productLevel1”: “MNHD”,
“productLevel2”: “MNH1”,
“productLevel3”: "MNH10059 ",
“productLevel1Desc”: “G”,
“productLevel2Desc”: “S”,
“productLevel3Desc”: “W”
}
]
How can I access this and get value of progressStatusValue
When then x it become
[null, null, {productLevel2=MNH1, progressStatusValue=C, progressStatusDesc=B, productLevel3=MNH10059 , productLevel1=MNHD, progressStatusId=1690, productLevel3Desc=W, productLevel2Desc=S, productLevel1Desc=G}, null, null, null, null, null, null, null]

Could you please elaborate more?
The filter [item != null] which is part of the shared expression should remove nulls

I tried and get progressStatusValue = C with this code
(for x in b, y in c return if (x.progressStatusId = number(y)) then x.progressStatusValue else null)[item != null][3]

With (for x in b, y in c return if (x.progressStatusId = number(y)) then x.progressStatusValue else null)[item != null] it always return as arrays

Is there a way to get progressStatusValue but I don’t need to define index like code above

Apparently the filter [item != null] doesn’t work in your case. Could you please share your model?

@hassang here my bpmn and dmn
5. Product Portal Event Process Test.bpmn (32.9 KB)
ProductPortal.Release1.020.TC CHUONG TRINH TIEN DO THUC HIEN PA.dmn (3.1 KB)
In bpmn it place here.
image
Please take a look. :slight_smile:

Hi @Mason_John

I wasn’t able to find the FEEL expression
(for x in b, y in c return if (x.progressStatusId = number(y)) then x else null)[item != null]

b is EventCriteriaProgressStatusArrayList and c CT_TienDoThucHien_NNDT1_Filter_1 @hassang