CacheControl / json-rules-engine

A rules engine expressed in JSON
ISC License
2.54k stars 455 forks source link

How to feed engine multiple facts as array! #326

Closed nileio closed 1 year ago

nileio commented 1 year ago

Hi, sorry it is a basic question but I have read the docs, and searched the Issues log. I am not sure why I could not find a way to feed the engine multiple facts at the same time. I tried an array of values, array of objects, etc. My values are simple numbers , so ideally I should just simply pass them as an array. I expect the engine to run each item in the array as a separate fact and run the rules against them. It works only if I have a for loop and run the engine on every iteration of the loop for a single value.

I am guessing there is a better efficient way than that. Can someone please provide an example ?

nileio commented 1 year ago

I had read and understood more from the code - basically a loop to add facts is the correct way of doing it