Adding scores of individual questions at end (Fagerström test score)

FormLogicError: Could not evaluate: [{“total”:“0”, “No response”: false}, {“total”:" <4",“Minimally dependent”: true},“,”, {“total”:“4”,“Moderately dependent “: true},”,”, {“total”:“5”,“Moderately dependent”: true},“,”, {“total”:“6”,“Moderately dependent”: true},“,”, {“total”:“7”,“Highly dependent”: true},“,”, {“total”:“8”,“Highly dependent”: true},“,”, {“total”:“9”,“Highly dependent”: true},“,”, {“total”:“10”,“Highly dependent”: true},“,”, {“total”:“str”," quote":" "“,“10”:” Highly dependent"},“,”, {“total”:“arr”,“V”:[]},“,”,{“total”:“arr”,“V”:[]}], message: Failed to execute ‘evaluate’ on ‘XPathEvaluator’: The string ‘{“total”:“0”, “No response”: false}, {“total”:" <4",“Minimally dependent”: true},“,”, {“total”:“4”,“Moderately dependent “: true},”,”, {“total”:“5”,“Moderately dependent”: true},“,”, {“total”:“6”,“Moderately dependent”: true},“,”, {“total”:“7”,“Highly dependent”: true},“,”, {“total”:“8”,“Highly dependent”: true},“,”, {“total”:“9”,“Highly dependent”: true},“,”, {“total”:“10”,“Highly dependent”: true},“,”, {“total”:“str”," quote":" "“,“10”:” Highly dependent"},“,”, {“total”:“arr”,“V”:[]},“,”,{“total”:“arr”,“V”:[]}]’ is not a valid XPath expression.

Hi @Varsha and welcome to the community!

Can you validate your form in here: ODK - XLSForm Online v2.x and share the screenshot with us?

1 Like

Fagerstrom test for nicotine dependence-smoking tobacco
How soon after you wake up do you smoke your first cigarette/bidi?
Within 5 min (3 points)
6–30 min (2 points)
31–60 min (1 points)
After 60 min (0 points)

Do you find it difficult to refrain from smoking in places where it is forbidden (e.g., at religious places, in school, in hospital, in bus/auto, in the cinema etc.)?
Yes (1 point)
No (0 point)

Which cigarette/bidi would you hate most to give up?
The first one in the morning (1 point)
Any other (0 point)

How many cigarettes/bidis per day do you smoke?
10 or less (0 points)
11 to 20 (1 points)
21 to 30 (2 points)
31 or more (3 points)

Do you smoke more frequently during the first hours after waking than during the rest of the day?
Yes (1 point)
No (0 point)

Do you smoke when you are so ill that you are in bed most of the day?
Yes (1 point)
No (0 point)

Scoring: 7 to 10 points= highly dependent; 4 to 6 points= moderately dependent; less than 4 points= minimally dependent

Hi
Thank you so much for ur response.

I have attached the error screenshot and also written the question above which I want to build into the form. I want to automatically add the points given in the options of each question to get added and displayed them at the end. Only 1 option will be selected in response to each question. pls, help me to generate such a form. thank you

@Varsha, maybe you could use this approach (discussed previously) to solve your issue: