The usual (and only reasonable way) to
"set" a variable in the LHS is to bind it to a Drools variable,
including things like:
...
$x : String() from /* expression here */
...
any usage of the "=" operator is generally suspicious..
but I'm not sure I have understood your use case completely.. :)
On 06/04/2013 05:59 PM, Stephen Masters wrote:
Thanks for the cheat idea Mike. I wasn't really expecting any
help from the tooling itself. Just hoping that there might be
some trickery within the DSL that I could try, to generate some
code which would set up a variable for me.
Unfortunately I do need to combine LHS sentences and multiple
RHS sentences, so your idea isn't really an option in this case.
:(
As it is I have created a little enumeration in the RHS
sentence, and it's not looking too bad. At least, with some
selective wording, it doesn't look completely redundant!
Steve
This would need to be provided by the tooling; I
don't think it's something that's even remotely
possible at runtime (unless you stored the field name
in a Fact and used reflection on the RHS).
That said (and you're going to guess my next comment)
this is not provided in the guided editors. Depending on
how complex your DSLs are and whether users need to
combine DSL Sentences; IDK if a "cheat" works:
[when]Do something with {field} and {value}=$f :
Fact({field}=={value} then $f.{field} = {value}
I've not tried it; nor know whether it fits your
requirements.. but a hack worth trying?
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users