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

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

Accessing values from the grid field

Calculations with grid fields are also possible. For example, you can calculate the sum of a row or column in your grid. This of course makes sense if you are using numerical fields, but can sometimes apply to dropdown fields as well.

 

Grid fields are stored as JSON objects. A JSON object looks like this:

 

{"0":{"0":"A","1":"C"},"1":{"0":"B","1":"D"}}

In this case, the grid field consists of 2 rows, numbered 0 and 1 (outside the inner brackets), and two columns, also numbered 0 and 1 (inside the inner brackets). For the case above, the grid would look like this in Castor:

 

Accessing values from the grid field

To access the values from the grid field you will first need to 'parse' the grid field. Parsing the grid field this will always be your first step. The code below will parse your grid variable.  

 

var obj = JSON.parse('{grid_variable_name}');

 

Afterwards you can do calculations with the individual items, as follows:

 

To get the value entered in the first row and first column, use:

 

Object.values(obj[0])[0];

To get the value entered in the second row and first column, use:

 

Object.values(obj[1])[0];

To get the value entered in the second row and second column, use:

 

Object.values(obj[1])[1];

and so on. You can perform further calculations with these values, depending on what you are trying to achieve.

 

You may also want to take a look at the articles Validate grid field values, Calculating with grids: numbers, or Calculating with grids: dates.

edc cdms grid calculate

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Allow data entry with different measurement units in EDC/CDMS
  • Calculate the average in EDC/CDMS
  • Check if all fields are filled in with 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