# expression manager problem.

• limesun
• Topic Author
• Visitor
5 years 3 weeks ago #100273 by limesun
limesun created the topic: expression manager problem.
i set assessment value for each question.
sometimes i use {sum（q1,q2)},can get the assessment value sum.
sometimes i can't. should change to {sum(q1.value,q2.value)}.
what's the problem.i am not sure about it.

5 years 3 weeks ago #100278 by jonsen
jonsen replied the topic: expression manager problem.
Dear limesun,

q1 (same as q1.code and q1.NAOK) will return the answer code of the answer selected in q1. The function sum() ignores all values which are not numeric. Therefore, your assessment values will only be correct if your codes in q1 and q2 are numeric.

Example:
sum(1,2) = 3
sum(1,'a') = 1

Best
jonsen

• limesun
• Topic Author
• Visitor
5 years 3 weeks ago #100280 by limesun
limesun replied the topic: expression manager problem.
normally, the q1.code is not number,like A1,L001.
when the assessment code is A1, i can get the sum(q1,q2)
when the assessment code is LOO1,the sum(q1,q2) is 0.
i guess it's a bug??

5 years 3 weeks ago #100282 by jonsen
jonsen replied the topic: expression manager problem.
Using Version 2.00+ Build 130923 I entered the following formulas:

sum(1,2,7,'a') = {sum(1,2,7,'a')}
sum(1,2,7,'L1') = {sum(1,2,7,'L1')}
sum(1,2,7,'L001') = {sum(1,2,7,'L001')}
sum(1,2,7,'L001L') = {sum(1,2,7,'L001L')}
sum(1,2,7,'LOO1') = {sum(1,2,7,'LOO1')}
sum(1,2,7,'001') = {sum(1,2,7,'001')}
sum(1,2,7,'001a') = {sum(1,2,7,'001a')}

...and the result was:

sum(1,2,7,'a') = 10
sum(1,2,7,'L1') = 10
sum(1,2,7,'L001') = 10
sum(1,2,7,'L001L') = 10
sum(1,2,7,'LOO1') = 10
sum(1,2,7,'001') = 11
sum(1,2,7,'001a') = 11 <-- the chars are considered numeric until the first non-numeric string.

This is what I expected. I don't know why you would get anything else...

• limesun
• Topic Author
• Visitor
5 years 3 weeks ago #100283 by limesun
limesun replied the topic: expression manager problem.
i only calculate the assessment value.
then
{sum(q1.value,q2.value,q3.value,....q80.value)}
oh my god,such a long expression.
because LS doesnot support {sum(group1.value)}