To return more than one column value in a single UserFunction#call, you can 
create a "container" Value object and place all your returned columns into it. 
For example, your #call method could return:
 
1) A plain-old-java Iterator/array/Collection, etc. (RU.EXTERNAL_ADDRESS) that 
contains your columns as plain-old-java-objects.
2) A List (RU.LIST)
3) A multi-slot (RU.MULTISLOT)
 
If you need to return more than one row per #call, you can have your user 
function return a row Iterator/Collection (RU.EXTERNAL_ADDRESS) that contains 
nested columns of Object values.
 
Or, you can return your JDBC RowSet object as an RU.EXTERNAL_ADDRESS.
 
alan
__________________
Bleib immer locker

________________________________

From: [EMAIL PROTECTED] on behalf of sivan k
Sent: Tue 3/22/2005 6:24 AM
To: jess-users@sandia.gov
Subject: Re: JESS: using Userfunctions


I am still having problems but I going to sit on it for now (I just hope I am 
not overlooking something very minor). Meanwhile as I mentioned earlier I want 
to work with a Mysql database. I have managed to connect to the data base using 
a Userfunction and insert values in a table. 
 
How would I be able to return multiple values of different types (eg. a client 
record - client id, name, address etc) to my Jess program without using 
multiple userfunctions (one for each value) after retrieving the values from 
the database.
 
Thanks
Jenny
 

[EMAIL PROTECTED] wrote:

        I think sivan k wrote:
        
        > Regarding the no such variable text error - I have not used
        > ?text variable outside the function if I have understood you
        > correctly. 
        
        Well, I don't know. I was curious enough to take your code and run it.
        It works for me with your "test.java" exactly as shown (adding an
        "import jess.*", of course), and with a few lines of initialization
        added to the Jess code. I can select something from the combo box,
        press the button, and get that thing printed. Because Jess 7 includes
        some changes in how Context works, I tried this with both Jess 6 and
        7; it works with both.
        
        Here's my complete Jess program:
        
        ; ----------------------------------------------------------------------
        (load-function test)
        (import javax.swing.*)
        
        (defglobal ?*argcombo* = (new JComboBox (create$ A B C)))
        (defg! lobal ?*ok* = (new JButton OK))
        
        (bind ?frame (new JFrame))
        ((?frame getContentPane) add ?*ok* "South")
        ((?frame getContentPane) add ?*argcombo* "Center")
        (?frame pack)
        (?frame setVisible TRUE)
        
        (deffunction inputstring (?EVENT)
        (bind ?arg (sym-cat (?*argcombo* getSelectedItem)))
        (compute ?text ?arg)
        (printout t ?text))
        
        (bind ?handler (new jess.awt.ActionListener inputstring(engine)))
        
        (?*ok* addActionListener ?handler)
        
        
        
        
        
        ---------------------------------------------------------
        Ernest Friedman-Hill 
        Advanced Software Research Phone: (925) 294-2154
        Sandia National Labs FAX: (925) 294-2234
        PO Box 969, MS 9012 [EMAIL PROTECTED]
        Livermore, CA 94550 http://herzberg.ca.sandia.gov
        
        
        --------------------------------------------------------------------
        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]
        --------------------------------------------------------------------
        
        

________________________________

Do you Yahoo!?
Yahoo! Small Business - Try our new resources site! 
<http://us.rd.yahoo.com/evt=31637/*http://smallbusiness.yahoo.com/resources/>  

<<winmail.dat>>

Reply via email to