-
Notifications
You must be signed in to change notification settings - Fork 509
add fact with array #287
wolfrednicolas
started this conversation in
General
add fact with array
#287
-
I have this code
engine.addFact('ref.insurance', (params, almanac) => {
return almanac.factValue('ref.insurances')
.then(insurances => {
let insurances_array = insurances.filter(insurance => insurance.health_insurance_code === '250')
console.log(insurances_array.length) //===> can be 0,1 or n
return insurances_array;
})
})
this is the condition
conditions: {
all: [
{
fact: 'ref.insurance',
operator: 'in',
value: ["250","55","33","44","55","11"],
path: '$.health_insurance_code'
}
]
},
it works if insurances_array[0], but I required the complete array.... this is the payload
[
{
"ref":
{
"family":
{
"record_type": "F",
},
"member":
{
"record_type": "M",
},
"household":
{
"record_type": "O",
},
"insurances": [
{
"record_type": "I",
"health_insurance_code": "250",
},
{
"record_type": "I",
"health_insurance_code": "250",
}
]
}
},
{
"ref":
{
"family":
{
"record_type": "F",
},
"member":
{
"record_type": "M",
},
"household":
{
"record_type": "O",
},
"insurances": [
{
"record_type": "I",
"health_insurance_code": "250",
}
]
}
}
}
]
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
@CacheControl any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions
1 reply
-
Did you get your solution? I have similar issue. My payload: { "myList": [1, 0, 88, 77] } my condition is fact: 'myList', operator: 'in', value: [100, 88]
Since 88 is in the data, the rule should return success correct? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment