How to convert Drools decision table (excel spread sheet) to a (.drl) file in Drools?

Let us try to create convert Drools decision table (excel spread sheet) to a (.drl) file in Drools.
The SpreadsheetCompiler class is used to convert the input XLS and CSV file to a (.drl) ໄຟລ໌. The required package is “org.drools.decisiontable.SpreadsheetCompiler”.You need to use the compile () method of this class to do the conversion. Following example shows the processs.



Example program:-

ການນໍາເຂົ້າ java.io.FileInputStream;
java.io.FileNotFoundException ການນໍາເຂົ້າ;
ການນໍາເຂົ້າ java.io.InputStream;
org.drools.decisiontable.InputType ການນໍາເຂົ້າ;
org.drools.decisiontable.SpreadsheetCompiler ການນໍາເຂົ້າ;

public class ExcelToDrlDemo {
ສາ​ທາ​ລະ​ນະ void ຕົ້ນ​ຕໍ static(String args[]) {
// create an input stream
InputStream ແມ່ນ = return NULL ກັບມາ;
ພະຍາຍາມ {
// assign the excel to the input stream
// mention the local directory path where your excel is kept
// you can take any decision table (excel sheet) for testing
= ໃຫມ່ FileInputStream ແມ່ນ(“D:/Workspace/TestProj/src/ExamplePolicyPricing.xls”);
} ຈັບ (ອີ FileNotFoundException) {
e.printStackTrace();
}
// create compiler class instance
SpreadsheetCompiler sc = SpreadsheetCompiler ໃຫມ່();
// compile the excel to generate the (.drl) ໄຟລ໌
String drl=sc.compile(ແມ່ນ, InputType.XLS);
// check the generated (.drl) ໄຟລ໌
System.out.println(“Generate DRL file is –: “);
System.out.println(drl);
}
}


============================================= ============================================== Buy best TechAlpine Books on Amazon
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share