I am unable to get the QueryResult returned by runQueryStar() in Java to
recognise column headings in a Userfunction. The UserFunction itself
worked with runQuery using the iterator and extracting the relevant Fact
from each Token. The new code is:
public Value call(ValueVector v, Context c) throws JessException {
engine = c.getEngine();
QueryResult result =
engine.runQueryStar("number-of-product-attributes-demanded",
new ValueVector(),c);
int maxAttributes = 0;
ValueVector products = new ValueVector();
while (result.next()) {
int num = result.getInt("number");
Value numValue = new Value(num, RU.INTEGER);...
The error is caused by the result.getInt("number") command.
The relevant defquery is:
query = "(defquery number-of-product-attributes-demanded"
+ "(number-desired-attributes))";
engine.executeCommand(query);
The relevant deftemplate is
d = new Deftemplate("number-desired-attributes",
"Number of attributes desired present at any level level",
engine);
d.addSlot("product", Funcall.NIL, "SYMBOL");
d.addSlot("number", Funcall.NIL, "INTEGER");
engine.addDeftemplate(d);
The value of of the QueryResult (taken from the private iterator's
ArrayList) at the time the JessException is called is:
[[Token:
size=2;sortcode=671;negcnt=0;facts=(MAIN::__query-trigger-number-of-product-attributes-demanded);(MAIN::number-desired-attributes
(product product-19) (number 16));], ... + 24 more.
An error occurred at line -1
The code looks like: null
MessageNo such variable number
Java exception is: null
Thanks in advance for any help on this.
--------------------------------------------------------------------
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]
--------------------------------------------------------------------