Food consumption calculation

Hello Team. I need help. I am building a form but i keep receiving this error. Its my first time and i suppose i havent gotten the formula right.

FormLogicError: Could not evaluate: ( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/cereals *2)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/tubers *2)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/pulses *3)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/vegetables *1)+($(fruits}*1)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/meat *4)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/dairy *4)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/sugar *0.5)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/oil *0.5)+( /model/instance[1]/aKKZhtRbRfyRctkidVMq9M/group_om4pz51/condiments *0)), message: Failed to execute ‘evaluate’ on ‘XPathEvaluator’: The string ‘fruits}*1’ is not a valid XPath expression.

Your error lies here. If you want to refer to a question, you need to use {}, ${fruits}. Please try to correct and let’s see if it fixes your problem.

1 Like

It is still not working even after fixing this error.

Hello @card,

Can you validate your form in here: ODK - XLSForm Online v2.x and share the screenshot? So we can try to solve the issues.

1 Like