<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">Hi there,</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">When using DSL to drive the guided editor, I seem to remember having similar trouble. I opted for writing DSL to generate code which stands alone and re-uses variables. i.e.</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">[when][]Given a request = $request : Request()</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">[when][]for a savings account = eval($request.getAccountType().equals("Savings"))</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">I don't think you can use DSL in decision tables (I'd love to be told that's no longer the case!), but if you need to do that kind of thing, it would probably be worth looking at rule templates instead. They behave a bit like a cross between a decision table and a guided rule.</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">I have had trouble with DSL-based rules and decision tables where defining an enumeration as a constraint on a field just doesn't get picked up in Guvnor. You need to explicitly define the enumeration within your DSL, like so:</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">[when][]Given a request for a "{account:ENUM:Account.AccountType}" account = AccountRequest(AccountType=="{account}")</div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">Hopefully that's useful …</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">Steve</div><div><br></div><br><div><div>On 5 Sep 2012, at 20:43, dme1 <<a href="mailto:mehtad@hotmail.com">mehtad@hotmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br><br>Do I have to use the Text based DSL Editor in Guvnor if I want to use DSL<br>which has definition for the Object and the fields within it (using the "-"<br>at the beginning). If I use this in the Guided editor, it shows are 2<br>separate rule entries.<br><br>Also can I use DSL for defining conditions and actions in a Guided Decision<br>Table, if yes is there an example which shows how to do this.<br><br>Also if I have a Domain Model, and if I use "Enumerations" to define<br>constraints on some of the fields (map to a list of values), these do not<br>show up when using DSL based rules in the Guided Editor, is there any way to<br>get this to work.<br><br>Thanks,<br>dme<br><br><br><br>--<br>View this message in context: <a href="http://drools.46999.n3.nabble.com/DSL-usage-in-Guvnor-tp4019609.html">http://drools.46999.n3.nabble.com/DSL-usage-in-Guvnor-tp4019609.html</a><br>Sent from the Drools: User forum mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote></div><br></body></html>