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

Calculating with grids: dates 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

Following the basics described in Calculate with grid fields, the current article explains how to calculate with grids when the cells have been defined as "date".


Once again, the first step is to parse the JSON string. Although not necessary, it may be helpful to then put each date in a variable and then work with them in our calculation. Here, we will work with the following example of a grid field named {gridField}:


We would like to know the amount of days that a patient has been hospitalized in the two visits to the hospital. Besides parsing the JSON string and declaring our variables for the dates, we will need to use the code in Calculate the difference between two dates.


First, we parse the grid field content:

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

* remember to replace '{gridField}' with the actual name of your grid variable


Since we have 4 dates, let's declare 4 variables, one for each of them:

var date1 = Object.values(obj[0])[0];
var date2 = Object.values(obj[0])[1];
var date3 = Object.values(obj[1])[0];
var date4 = Object.values(obj[1])[1];


Then, we calculate the difference between the admission and discharge dates for the first and the second hospitalization, separately:

var diffVisit1 = getDateDiff(date2,date1,'d')
var diffVisit2 = getDateDiff(date4,date3,'d')


Finally, we can show the result in a legible manner, for example:

"First visit: " + diffVisit1 + " days; " + "Second visit: " + diffVisit2 + " days"


In our study, all these pieces of code together will result in:



dates grids

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Check if the inclusion criteria are met in EDC/CDMS
  • Check if all fields are complete (and list empty 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