Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Contact Us
  • Home
  • CDMS
  • Frequently Asked Questions
  • Troubleshooting

Calculation errors: EDC/CDMS

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • CDMS
    Castor CDMS Manual Castor CDMS Calculations Manual Frequently Asked Questions Articles for Data Managers Castor CDMS Compliance Release Documents
  • eConsent
    Castor eConsent Manual Castor eConsent Compliance Release Documents
  • SMS
    Castor SMS Manual Castor SMS Compliance Release Documents
  • Castor Connect
    Castor Connect Compliance Release Documents Castor Connect Manual Castor Connect - Participant Quick Start Guide
  • Helpdesk
    News Other Resources Castor products knowledge resources
  • Status page
  • Completing a Study
+ More

Table of Contents

Not all values for this calculation are available (yet) Unexpected end of input Unexpected identifier Invalid or unexpected token Missing ) after argument list Cannot read property '4' of null, Unable to get property '4' of undefined or null reference Calculating with User Missing Values

This article provides an overview of errors you might find in your calculation field in data entry. The most common reason for calculation errors are mistakes in syntax (in the calculation template). You can check your calculations using the Castor Calculation Helper - this tool can help identify syntax errors and incorrect references in calculations.

First make sure that when using a variable that is marked as a string (e.g. a checkbox field, a text field or a date field - anything that is not a numerical value), the variable name is between quotation marks, such as "{date_of_visit}". This is the most common reason for calculation errors.

Errors in calculation fields can be seen in data entry, and look something like this:

In the examples below some other frequent errors are shown. For every error, you will see the wrong calculation with comments about what is wrong after "//Reason:". The correct solution is shown below under "//Solution".

Not all values for this calculation are available (yet)

This is not an error per se, but simply indicates that not all values are available for the variables used in the calculation. This includes the situation when there is a dependent field used in the calculation which has no data. The error can be solved using '##allowempty##' in the beginning of the calculation. For more information, see the article Forcing Castor to calculate with empty fields.

Unexpected end of input

This can mean that one of your opening parentheses "(" or brackets "{" is not closed with ")" or "}". For example, the following calculation misses a closing bracket } in the end :

//Example of an unexpected end of input
'##allowempty##';
if ("{allergy}" == "'NA'") {
1; //Reason: A closing bracket is missing!
//Solution
'##allowempty##';
if ("{allergy}" == "'NA'") {
1;
} //Correct!

Unexpected identifier

This can mean that both double and single quotation marks are used:

//Example 2 of an unexpected identifier
'##allowempty##';
if ('{allergy}' == "'NA'") { //Error: {allergy} should be with double quotation marks, because 'NA' also uses double quotation marks!
"The patient does not have allergies.";
}
//Solution
'##allowempty##';
if ("{allergy}" == "'NA'") { //Correct!
"The patient does not have allergies.";
}

Invalid or unexpected token

This can mean that

  • One of your quotes is not closed:
//Example of a missing closing quote
'##allowempty##';
if ("{allergy}" == "'NA'") {
"The patient does not have allergies.; //Reason: a closing quotation mark is missing here!
}
//Solution
'##allowempty##';
if ("{allergy}" == "'NA'") {
"The patient does not have allergies."; //Correct!
}
  • There are too many brackets { } or parentheses ( ):
//Example of too many brackets
'##allowempty##';
if ("{meds}" == "'NA'") {{ //Error: there are too many brackets!
"No medication";
}
//Solution
'##allowempty##';
if ("{meds}" == "'NA'") { //Correct!
"No medication";
}
  • There are too few brackets { } or parentheses ( ):
//Example of too few parentheses
'##allowempty##';
if ("{meds}" == "'NA'" { //Reason: a closing parenthesis is missing here!
"No medication";
}
//Solution
'##allowempty##';
if ("{meds}" == "'NA'") { //Correct!
"No medication";
}

Missing ) after argument list

This can mean that you're trying to use getTimeDiff with empty values. Solution: Insert these tags at the top of your calculation:

'##allowempty##'; '##setemptytozero##';

Cannot read property '4' of null, Unable to get property '4' of undefined or null reference

This can mean that you're trying to use some functions, such as getDateDiff, with empty values. This type of function cannot use empty values. If you are using the '##allowempty##' tag in your calculation, make sure that you actually need to use this tag - this is only necessary when you need to force Castor to calculate with empty fields, for example, if you are checking whether a field is empty.

Calculating with User Missing Values

If a calculation contains variables that have been marked as missing within the record, the output will be 'NaN'.

error diagnosis mistake calculation

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • After copying a step all dependencies disappeared: EDC/CDMS
  • I created a record with a wrong participant id can I change it: EDC/CDMS
  • I use two factor authentication and have a new device: EDC/CDMS
  • How can I request a study back up recovery: EDC/CDMS
ISO 27001
FDA - 21 CFR part 11
ICH GCP compliant
HIPAA compliant
CDISC
ISO 9001
gdpr compliant

Products & Industries

  • Electronic Data Capture (EDC)
  • ePRO
  • eConsent
  • Decentralized Clinical Trials (DCT)
  • Clinical Data Management
  • Medical Device & Diagnostics
  • Biotech & Pharma
  • CROs
  • Academic Research

Resources

  • Thought Leadership
  • Blog
  • Castor Academy
  • Knowledge Base

 

Company

  • About Us
  • Careers
  • News
  • Contact Support
  • Contact Us

Legal & Compliance

  • Terms of Use
  • Privacy & Cookie Statement
  • Responsible Disclosure Policy
  • Good Clinical Practice (GCP)
  • ISO Compliance Certificates
  • GDPR & HIPAA Compliance
  • Security Statement

© 2022, Castor. All Rights Reserved.

Follow us on social media


Knowledge Base Software powered by Helpjuice

Definition by Author

0
0
Expand