Hide Forgot
Created attachment 1142481 [details] XLS decision table to convert Description of problem: We have a XLS decision table (attached) we are converting to guided DT. The DT uses a data object like this: public class Message { public static final int HELLO = 0; public static final int GOODBYE = 1; private String message; private int status; <message and status getters and setters> } When the XLS DT is converted in business central, only one column (out of 4) is filled with data. Version-Release number of selected component (if applicable): 6.3.0 ER2 Steps to Reproduce: 1. Create a project with packages guvnor.feature.dtables, add the Message data object to the guvnor.feature.dtables package. 2. Upload the provided XLS DT to the guvnor.feature.dtables package. 3. Convert the XLS DT to a guided DT. 4. Check the cells/source of the converted guided DT. Actual results: There are two rows/rules, only one has any data and that is limited to 'm.setMessage( "Goodbye cruel world" );' Expected results: Two rows/rules with conditions and actions as set in the XLS DT.
Created attachment 1142482 [details] data object used in the dtable
Created attachment 1142483 [details] guided dtable - result of conversion
I tried the provide XLS file with Community 6.4.x (i.e. BxMS 6.3.x) and it converted fine (there have been changes for 6.4.x). See attached screen shot of the converted table.
Created attachment 1142488 [details] Converted with Community 6.4.x
Set to MODIFIED for QE verification.
From that screenshot, I'd say it's better but still not there yet. Maybe I understand the XLS dt wrong, but I'd say that the converted boolean cells (print out msg) should be set to true and the last column in first row should be also set to Message.GOODBYE. Please correct me if I'm wrong, but otherwise, could you look at it?
Hi Zuzana, There are a number of issues:- 1) "X" is not recognized as "true", hence the Checkboxes are not ticked: See https://github.com/droolsjbpm/drools/blob/master/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/RuleSheetParserUtil.java#L96 2) The XLS Conversion doesn't support use of public Java constants in the XLS source. The conversion process knows the data-type of the field (in this case "int") and attempts to convert the XLS cell value to an integer. Where it fails a null value is converted. Older versions of the conversion did not care about field data-types and the whole XLS column definition was dumped as "free format DRL" whereas now it converts to more fine-grained "Guided Rule Editor components". See the referenced JIRA. Let me see if I can at least improve reporting of the conversion for #2; so Users know something didn't go according to plan.
Zuzana, consider the revised XLS I've attached; where numerical fields contain numerical values in the XLS. There's little we can do to accommodate public constants on a Java class at the moment - BxMS simply doesn't capture that information for *authoring*. For example, try creating a Guided Rule where "status == Message.Hello". There are two things we could do: (1) The XLS could contain a data-list, so the User selects HELLO or GOODBYE from a drop-down. This is replicated in BxMS as an "Enumeration" definition for "Message.status:[1=HELLO, 2=GOODBYE]" (I forget the syntax). Then any Rule authoring could use HELLO/GOODBYE. (2) When converting the XLS any values in the source that cannot be converted to the data-type of the field is reported as an error (at the moment HELLO and GOODBYE silently fail to convert and are nulled). I think the improvements for GUVNOR-2030 far out-weigh the issue reported here. WDYT?
Created attachment 1144312 [details] Use of numeric cell values for numeric data-types
Thanks for the explanations Mike. So, the XLS itself is valid, but some elements (the java constants) cannot be converted to a gdt, right? In that case, it would be good to add these and any other (!) conversion fails to the Conversion Results modal. The XLS would still be converted (although with some fails) and the user would know what to look at and fix. (The XLS we can tweak on our side to fit with the conversion or count with the fails in the tests then, that is no trouble.) Btw, do you know of any other limitations of the XLS -> GDT conversion? It might be good to put these things into the docs...