{"action":"opened","issue":{"url":"https://api.github.com/repos/C2FO/nools/issues/197","repository_url":"https://api.github.com/repos/C2FO/nools","labels_url":"https://api.github.com/repos/C2FO/nools/issues/197/labels{/name}","comments_url":"https://api.github.com/repos/C2FO/nools/issues/197/comments","events_url":"https://api.github.com/repos/C2FO/nools/issues/197/events","html_url":"https://github.com/C2FO/nools/issues/197","id":167640308,"number":197,"title":"Unable to retrieve facts in a loop","user":{"login":"Hervinho","id":6742076,"avatar_url":"https://avatars.githubusercontent.com/u/6742076?v=3","gravatar_id":"","url":"https://api.github.com/users/Hervinho","html_url":"https://github.com/Hervinho","followers_url":"https://api.github.com/users/Hervinho/followers","following_url":"https://api.github.com/users/Hervinho/following{/other_user}","gists_url":"https://api.github.com/users/Hervinho/gists{/gist_id}","starred_url":"https://api.github.com/users/Hervinho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hervinho/subscriptions","organizations_url":"https://api.github.com/users/Hervinho/orgs","repos_url":"https://api.github.com/users/Hervinho/repos","events_url":"https://api.github.com/users/Hervinho/events{/privacy}","received_events_url":"https://api.github.com/users/Hervinho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-26T15:41:53Z","updated_at":"2016-07-26T15:41:53Z","closed_at":null,"body":"Hi! I am trying to retrieve facts in a for loop, coz Im sending differenct array objects to the rules, but when I retrieve, only the first object sent to the engine is retrieve. I dont know why. Here is my code:\r\n`for(var i = 0; i < rows.length; i++){\r\n\t\t\t\t\t\t\tev[i] = new Event(rows[i].id, rows[i].name, rows[i].code, rows[i].category_id, rows[i].inventory, rows[i].type,\r\n\t\t\t\t\t\t\t\trows[i].value, rows[i].total);\r\n\t\t\t\t\t\t\t\teventSentToRule = flow.getSession(ev[i]); //assert event\r\n\t\t\t\t\t\t\t\t//Fire rules and retrieve facts\r\n\r\n\t\t\t\t\t\t\t\teventSentToRule.on(\"event\", function (obj) { eve = obj.event;})\r\n\t\t\t\t\t\t\t\t\t\t.match().then(function (err) {\r\n\t\t\t\t\t\t\t\t\t\t if(err){\r\n\t\t\t\t\t\t\t \t        console.error(err);\r\n\t\t\t\t\t\t\t \t\t\t\t\tres.redirect('/home');\r\n\t\t\t\t\t\t\t \t    }else{\r\n\t\t\t\t\t\t\t\t\t\t\tif(eve){\r\n\t\t\t\t\t\t\t\t\t\t\t\teventOutputFromNools[i] = eve;\r\n\t\t\t\t\t\t\t\t\t\t\t\tconsole.log(\"Type: \" + eventOutputFromNools[i].type);\r\n\t\t\t\t\t\t\t\t\t\t\t\t//console.log(eve.type);\r\n\t\t\t\t\t\t\t\t\t\t\t\teventSentToRule.dispose();\r\n\t\t\t\t\t\t\t\t\t\t\t\tres.redirect('/newsponsorship');\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t });\r\n\t\t\t\t\t\t\t\t eventSentToRule.dispose();//this remains\r\n\t\t\t\t\t\t}`\r\nAnd my nools rule engine is as follows: `rule TicketHospitalityTier2{\r\n  when{\r\n    e: Event e.code == \"TICKETS_HOSPITALITY\" && e.type == \"T2\";\r\n  }\r\n  then{\r\n    var reach = e.inventory * 0.30;\r\n    modify(e, function(){ this.total = reach * e.value;});\r\n    this.emit(\"event\", {event:e});\r\n    this.assert({event:e});\r\n    console.log(\"Category TICKETS_HOSPITALITY T2 - Total: \" + e.total);\r\n  }\r\n}`\r\nSo it seems like I can only get eventOutputFromNools[0]. Thanks for the help"}}
{"actor":{"display_login":"Hervinho"}}