You just need to take things one step at a time. First enter the
function from the command prompt, and make sure it works. The function
you show below is incorrect; the second argument "toString" to the
return function will be ignored -- maybe you mean (return (call ?val
toString)) ? In any event, debug your functions at the command line,
first, and make sure they work the way you expect.

Then try to call the function from Java. Adding functions to
scriptlib.clp isn't really a recommended practice, although it will
work. A better practice is to put your code into a file and use

  rete.executeCommand("(batch myFile.clp)");

to read it in. Then then try calling

  rete.executeCommand("(printout t (list-function$) crlf)");

to display a list of defined functions, and make sure yours is on
it. Be careful of spelling and punctuation. If it appears in the lsit,
then an "unimplemented function" error message won't appear, so you
will have solved your problem by this point.




I think prasanna vasan wrote:
> Many thanks for sending reply...
> 
> cont with my question.......
> 
> i have defined a deffunction in the scriptlib.clp file
> 
> this is the code...
> 
> 
> (deffunction testFunction (?uid)
>   "Test Function is called."
> (bind ?dbconnection (new DB))
> (bind ?val (call ?dbconnection getDBConn ?uid))
> (return ?val toString))
> 
> 
> where the DB is a Java Class which does the database part........
> 
> 
> and the code which calls is
> 
> rete.executeCommand("(testFunction userid)");
> 
> and i get the userid value from the other program....
> 
> but it says unimplemented function testFunction userid.....
> 
> so how to pass a String Value .....
> 
> 
> Thanks
> 
> 
> 
> 
> 
> 
> 
> 
> 
> >From: [EMAIL PROTECTED] (friedman_hill ernest j)
> >To: prasanna vasan <[EMAIL PROTECTED]>
> >CC: [EMAIL PROTECTED]
> >Subject: Re: JESS: Problem with Multislot Values
> >Date: Thu, 23 Aug 2001 09:02:46 -0700 (PDT)
> >
> >I think prasanna vasan wrote:
> > >
> > > I have a deftemplate with slot
> > >
> > > i.e (deftemplate Test(slot name))
> > >
> > > and i have set the value as let me say jess..
> >
> >I'm assuming you mean that you've asserted a fact (Test (name jess)).
> >
> > >
> > > now how to check wheather the deftemplate Test with the value jess is
> > > existing in the Rete Working memory...
> > >
> >
> >Use (facts) to find it by hand, or a rule or defquery to find it
> >programmatically, or even call Rete.listFacts() and iterate through
> >the fact-list. I'm afraid I probably don't understand the question.
> >
> >
> > >
> > > Another Problem....
> > >
> > > I have a Java Class which does the JDBC connection part ....
> > >
> > > name of the file is DB.java
> > >
> > > now i have defined the userfunction called DatabaseConnection which 
> >takes 2
> > > args (uid,pwd)
> > >
> > > now how to assert the value from the Java...
> > >
> > > i.e rete.executeCommand("DatatbaseConnection ?uid ?pwd");
> > >
> > > when i do this it takes userid as uid and password as pwd
> > >
> > > but iam storing the correct userid in the uid var...so which means the
> > > problem is passing the strings....can u give me asol with samples...
> > >
> >
> >You might consider reading the manual. Section 4.4.4 in the Jess 6.0a8
> >manual gives an example of exactly how to do what you want.
> >
> > > Regards
> > >
> > > Prasanna
> > >
> >
> >
> >
> >---------------------------------------------------------
> >Ernest Friedman-Hill
> >Distributed Systems Research        Phone: (925) 294-2154
> >Sandia National Labs                FAX:   (925) 294-2234
> >Org. 8920, MS 9012                  [EMAIL PROTECTED]
> >PO Box 969                  http://herzberg.ca.sandia.gov
> >Livermore, CA 94550
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> 
> 
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

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