What are we expected to check or where do you need help? The code
you've posted does not concur with the problem you've described
being in the .xls-file.
-W
On 18/06/2013, ashish6276 <ashishkumarec010(a)gmail.com> wrote:
Hi,
We are importing excel in drool by using drool API. we are facing issue in
applying multiple condition into
various columns. Defined excel rule for one particular column but we are not
able to get condition or rule in
.drl file.below is the code.
public class DroolExcelDemo {
public static final void main(final String[] args) {
// Create knowledge builder
final KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
// Create drl file from excel sheet
InputStream is =null;
try {
is= new FileInputStream("C:/POCExcel.xls");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
// Create compiler class instance
SpreadsheetCompiler sc = new SpreadsheetCompiler();
// Compile the excel to generate the (.drl) file
StringBuffer drl=new StringBuffer(sc.compile(is,InputType.XLS));
// Insert dialect value into drl file
drl.insert(drl.indexOf("DROOLS")+40,"dialect
\"mvel\""+"\n");
// Check the generated drl file
System.out.println("Generate DRL file is showing below–: ");
System.out.println("Value of xls in drl"+drl);
// writing string into a drl file
try {
BufferedWriter out = new BufferedWriter(new FileWriter("C:/rules.drl"));
out.write(drl.toString());
out.close();
//System.out.println("print content"+out.append(csq, start, end));
}
catch (IOException e){
System.out.println("Exception ");
}
// Wait before using the drl file in the next section.
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("testing");
// End creation of drl file from excel sheet
// Using DRL file
kbuilder.add(ResourceFactory.newClassPathResource("rules.drl",DroolMessage.class),ResourceType.DRL
);
// Check the builder for errors
if ( kbuilder.hasErrors() ) {
System.out.println("kbuilder has errors");
System.out.println( kbuilder.getErrors().toString());
}
// get the compiled packages (which are serializable)
final Collection pkgs = kbuilder.getKnowledgePackages();
can anyone help on this. Thanks in advance
--
View this message in context:
http://drools.46999.n3.nabble.com/Applying-complex-condition-in-excel-whi...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users