Calculation Error: Error in calculation for /data/L Logic references instance(LMS_WFA)/zscore/gender[@id = /data/child_gender]/age[@id = /data/age_months_weight_gmp]/L which is not a valid question or value.
I'll help you resolve this WHO LMS calculation error. Let me first read the full details of your post and then search the knowledge base for relevant information.
This error occurs when CommCare cannot find the lookup table data you're referencing. Based on your error message, the calculation is trying to reference instance(LMS_WFA)/zscore/gender[@id = /data/child_gender]/age[@id = /data/age_months_weight_gmp]/L, but CommCare reports it's not a valid question or value.
Here are the most common causes and solutions:
1. Lookup table not uploaded or linked to your form
- Verify that your LMS_WFA lookup table is uploaded to your application in the Application Builder
- Check that the lookup table is properly linked to the form where you're using this calculation
2. Incorrect instance name
- Confirm the lookup table instance name is exactly
LMS_WFA(case-sensitive) - Check that this matches the name you used when uploading/defining the lookup table
3. Structure mismatch
- Verify your lookup table has the expected structure:
zscore/gender/age/L - Ensure the column/field names in your lookup table match exactly (including case)
4. ID matching issues
- Check that
/data/child_gendercontains values that match theidattribute in your lookup table's gender nodes - Verify
/data/age_months_weight_gmpcontains values that match theidattribute in your lookup table's age nodes
Common troubleshooting steps:
- Re-upload your lookup table fixture
- Verify the XML structure of your lookup table matches your XPath query
- Test with hardcoded values first to confirm the table structure is correct
- Check that the form is saved and rebuilt after linking the lookup table
If you've verified all of these and the issue persists, please submit a support ticket at Jira Service Management with:
- Your application name and form name
- The lookup table file you're using
- Screenshots of your calculation and form setup
- Steps to reproduce the error