You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose the fact is
const fact={
id:1,
username:'sureshk',
student:[{name:'zbc',percentage:100},{name:'zb',percentage:10}],
role:['coach','mentor'],
sport:['hockey','base']
}
and the rule should be
rule criteria => (student.name ='zbc' AND student.percentage=100) AND id=1 AND username='sureshk' AND role = 'coach' AND sport='hockey'
what will the json rules for the above rule criteria and facts
@suresh-webonise can you clarify the structure of the facts? Specifically the role, name, and sport.
If role is an array containing multiple roles you can do a contains check. If it's a single role you can use an equality check.
Activity
chris-pardy commentedon Nov 13, 2023
@suresh-webonise can you clarify the structure of the facts? Specifically the role, name, and sport.
If role is an array containing multiple roles you can do a contains check. If it's a single role you can use an equality check.
For example:
augustosilas commentedon Nov 13, 2023
I hadn't realized that students was an array of objects. In this case, I created a custom operator that searches for an object within an array.