<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><base href="x-msg://468/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I think I have a better idea of what you're trying to do now. Below is the content of a message I sent to this list the other day. I think you might find the technique relevant to what you are doing. i.e. Create a DSL which refers to an enumeration which you define. That way, you get drop-down menus in the DSL sentences. That makes life easy for your users. From there you are able to take the value from the enum and use it in the generated code. Note that in the code below, it is taking the value of "unit" from the enumeration and using that as the field being matched in the code.</div><div><br></div><div>The rest is from my previous email...</div><div><br></div><div><br></div><div><div>I just couldn't find any examples of the DRL syntax for 'creating' a value like that in the LHS. A quick test with a contrived little example shows me that the following works:</div><div><br></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">rule "Warn when my meal is too large"</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">when</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp;&nbsp;$meal: Meal($calories: calories &gt; 1000)</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp;&nbsp;$unit: String() from "calories"</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">then</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp;&nbsp;insert(new MealTooBigWarning("That meal is bigger than your 1000 " + $unit + " limit."));</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">end</div></div></blockquote><div><br></div><div>So, based on that I'm able to write a DSL like this:</div><div><br></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><div style="margin: 0px; "><div style="margin: 0px; ">[when][]I am given a meal of more than "{sizeLimit}" "{unit}" = $meal: Meal($size: {unit} &gt; {sizeLimit}); $sizeLimit: Integer() from {sizeLimit}; $unit: String() from "{unit}"</div></div></div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><div style="margin: 0px; "><div style="margin: 0px; ">[then][]Warn that the meal is too big = insertLogical(new MealTooBigWarning("That meal is bigger than your " + $sizeLimit + " " + $unit + " meal limit."));</div></div></div></div></blockquote><div><div><br></div><div>Which means that I can write DSLR like this:</div><div><br></div></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">rule "Warn when my meal has too many calories"</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">when</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp; I am given a meal of more than "1000" "calories"</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">then</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp; Warn that the meal is too big</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">end</div></div></blockquote><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; min-height: 15px; ">… which gives me:</div><div style="margin: 0px; min-height: 15px; "><br></div></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><div style="margin: 0px; ">That meal is bigger than your 1000 calories meal limit.</div></div></blockquote><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; min-height: 15px; ">Or this:</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">rule "Warn when my meal has too many diet club points"</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">when</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp; I am given a meal of more than "11" "dietClubPoints"</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">then</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">&nbsp; &nbsp; Warn that the meal is too big</div></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">end</div></div></blockquote><div><div><br></div><div>… which gives me:</div><div><br></div></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">That meal is bigger than your 11 dietClubPoints meal limit.</div></blockquote><div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div></div><div style="margin: 0px; "><div style="margin: 0px; ">So I can define an enumeration:</div><div style="font-size: 11px; font-family: Monaco; margin: 0px; "><br></div></div></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px; "><div style="margin: 0px; "><div style="font-size: 11px; font-family: Monaco; margin: 0px; ">'MealSize.units': ['calories=calories', 'dietClubPoints=diet club points']</div></div></blockquote><div><div><br></div><div>So that in Guvnor, I have a single sentence with a drop-down menu containing the options "calories" and "diet club points". That keeps things nice and clean for the users.</div></div></div><div><br></div><div><br></div></body></html>