Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add fact with array #287

wolfrednicolas started this conversation in General
Discussion options

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",
 }
 ]
 }
 }
 }
]
You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

@CacheControl any thoughts?

You must be logged in to vote
1 reply
Comment options

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /