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
  • Castor CDMS Calculations Manual
  • General calculation templates

Check if a number contains X number of digits or decimal places in 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

Format 000 Format 00.0 Format 0.000 Regular expressions

Using calculation fields, it is possible to check if the number that is entered in a numerical field corresponds to a certain format. For example, you can check if a number contains 3 digits or if it contains 2 decimals.

Format 000

This template will check how many digits a number contains:

 

'{number_variable}'.length

Set up a data validation in case the number exceeds or less than a necessary amount of the digits.

Format 00.0

This template will check for the format 00.0 precisely, thus 11.1 will be valid and 1.11 will be invalid:

 

if ((/^\d{2}(\.\d{1})$/).test('{number_field}')) {
 "The number format (00.0) is correct!"
} else {
 "The number does not correspond 00.0. Please enter the number in the correct format 00.0."
}

Format 0.000

This template will check for the format 0.000 precisely, thus 1.123 will be valid and 12.1234 will be invalid:

 

if ((/^\d{1}(\.\d{3})$/).test('{number_field}')) {
 "The number format is correct!"
} else {
 "The number format is incorrect. Please enter the correct number."
}

Regular expressions

These templates use so called 'regular expressions' and you can create your own template by modifying this line:

 

(/^\d{2}(\.\d{1})$/)

 

You would need to adjust the pattern that marked bold leaving the backlash and the brackets. There are tools which can help you develop your own regular expression patterns:

  • JavaScript RegEx Reference
  • regex101
check quantity quantify digits

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Calculate with grid fields in 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