Closed rzanussigmail closed 1 year ago
The signature in the readme file is wrong, doesn't include the error object so your function is returning the error.
decisionTable.execute_decision_table("EB", decision_table,payload, (**err,** resu)=> { console.log("Rule result: " + resu) });
decisionTable.execute_decision_table("EB", decision_table,payload, (err, resu)=> {
console.log("Rule result: ", err, resu);
});
As pointed out by @davidsamlee callback function takes two arguments (err, results)
I execute the code as in the exmaple also with table of exemple but always i ahve null en return
const { decisionTable } = require('js-feel')(); var path = require('path'); var root = path.dirname(require.main.filename) //var absolutePath = path.join(root,req.files['dectabv.xls'].path) console.log(root); //console.log(absoluthPath); root = root + "\dectabu.xls"; console.log(root); //const csv = decisionTable.xls_to_csv('./dectabu.xls'); const csv = decisionTable.xls_to_csv('./EBB.xlsx'); console.log(csv[0]); const decision_table = decisionTable.csv_to_decision_table(csv[0]);
console.log(decision_table);
//const payload = {a : 0}; var resu; const payload = {'State' : 'Kerela', 'Bit' : 'b'}; console.log(payload); decisionTable.execute_decision_table("EB", decision_table,payload, (resu)=> { console.log("Rule result: " + resu) });
EB&SP&SP&SP RuleTable&SPCondition&SPCondition&SPAction C+&SPState&SPBit&SPAmount 1&SP"""Karnataka"""&SP"""a"""&SP200 2&SP"""Kerela"""&SP"""b"""&SP300
{ inputExpressionList: [ 'State', 'Bit' ], inputValuesList: [ '"Karnataka","Kerela"', '"a","b"' ], outputs: [ 'Amount' ], outputValues: [ [ '200', '300' ] ], ruleList: [ [ '"Karnataka"', '"a"', '200' ], [ '"Kerela"', '"b"', '300' ] ], hitPolicy: 'C+', context: null } { State: 'Kerela', Bit: 'b' } Rule result: null