Thanks Wolfgang. I was begining to readapt my application using facts, but Ernest gave me the solution for my problem. In the future I will try to avoid using global variables. Ana
--- On Mon, 4/13/09, Wolfgang Laun <[email protected]> wrote: From: Wolfgang Laun <[email protected]> Subject: Re: JESS: Resend message To: [email protected] Date: Monday, April 13, 2009, 3:19 PM My standard suggestion for handling parameters coming from some (G)UI is to set up one fact containing slots dedicated to those parameters. Any input event results in an update of this Parameter fact. Stay away from globals. -W On Mon, Apr 13, 2009 at 1:50 PM, Ernest Friedman-Hill <[email protected]>wrote: > You could just call (set-reset-globals FALSE), set your global(s) to the > value(s) you want, then call (reset) to evaluate the rules. > > > On Apr 13, 2009, at 7:25 AM, ANA TANASESCU wrote: > > Dear Ernest, >> >> I know that when the working memory is changed the rule will be >> reevaluated. >> >> You see when I said that with the following simple function my problem >> disappeared I didn’t realize that in this example I initialize the global >> variable calling that function and because of that my application works. >> (deffunction read-number() >> (printout t "Read the number") >> (bind ?n (read)) >> (return ?n)) >> (defglobal ?*category* = (read-number)) >> >> It is possible to initialize a global variable using a value from a text >> field? >> If the answer is yes how can I define that function? >> >> I tried to put the defglobal construct in the following function but a >> constructor can’t stay there: >> (deffunction read-category(?EVENT) >> (defglobal ?*category*=(integer(?*textfield* getText))) >> (assert(insert(integer(?*textfield* getText))))) >> >> If I define the global variable outside this function and bind it after >> with the new value, still wont works because the rule won’t be reevaluated. >> >> What shall I do? >> >> Best regards, >> Ana >> >> >> > --------------------------------------------------------- > Ernest Friedman-Hill > Informatics & Decision Sciences Phone: (925) 294-2154 > Sandia National Labs > PO Box 969, MS 9012 [email protected] > Livermore, CA 94550 http://www.jessrules.com > > > > > > -------------------------------------------------------------------- > To unsubscribe, send the words 'unsubscribe jess-users [email protected]' > in the BODY of a message to [email protected], NOT to the list > (use your own address!) List problems? Notify [email protected]
