[Edit]
Sorry, I have isolated the real problem to sometimes "$?upper" is a empty
multislot.
Question: how can I do a test to ensure that if (upper-match) is not a empty
slot, then print (upper-match)
Does $? means anything, including null? How to do a check for a empty
multislot
(defrule print-rule2
(body-muscle (upper-match $?upper) (lower-match $?lower))
(test (neq $?upper null ))
(test (neq $?lower null))
=>
(printout t "upper is not empty" $?upper)
(printout t "lower is not empty" $?lower))
Please ignore the post below
sorry,
Rick
[Edit]
*************************************************************
Hi,
This might sound weird but how do I convert a Jess multislot list into a
Jess string, inside Jess?
Its hard for me to explain but I need it to make the following method work.
"upper" needs to be replaced by $?upper
"lower" needs to be replaced by $?lower
But if I replace it as it is, the output is wrong. So I need to convert
$?upper into a string 1st, then replace the "lower" with the string.
Question: How do I convert $?upper into a string? And bind it to some ?name.
thanks n rgds
Rick
(defrule print-rule
(user (session $?session))
(program-cardio (c-dura ?cc) (i-dura ?ci) (m-dura ?cm))
(program-muscle (c-dura ?mc) (i-dura ?mi) (m-dura ?mm))
(body-muscle (upper-match $?upper) (lower-match $?lower))
=>
(bind ?totalwksC (+ ?cc ?ci ?cm))
(bind ?totalwksM (+ ?mc ?mi ?mm))
(bind ?countwks 1)
(bind ?next 1)
(bind ?muscle "")
(bind ?upper $?upper)
(bind ?lower $?lower)
(while (<= ?countwks ?totalwksC) do
(foreach ?date $?session
(if (<= ?countwks ?totalwksM) then
(if (= ?next 1) then
(bind ?muscle "upper")
(bind ?next 0)
else
(bind ?muscle "lower")
(bind ?next 1)
);if
else
(bind ?muscle "")
);if
(assert (each-week (ident each-week) (week ?countwks) (day
?date) (cardio
cardio) (muscle ?muscle)))
);for
(bind ?countwks (+ ?countwks 1))
);while
);close rule
--
View this message in context:
http://www.nabble.com/Jess%3A-checking-if-a-multislot-is-empty-tf3546357.html#a9899823
Sent from the Jess mailing list archive at Nabble.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]
--------------------------------------------------------------------