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].
--------------------------------------------------------------------

Reply via email to