Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
customErrorMessage('This is a new error message.');

findCompletedFormData

This method looks up previously collected study data for the current subject. Timepoint is optional.

Code Block
  var baselineForms = findCompletedFormData("Study Event Name", "Form Name, "TIMEPOINT");

Note that this method will return ALL collected instances of matching form data, including nonconformant and canceled data. To account for this be sure to filter the returned data accordingly.

...

Code Block
  var baselineForms = findFormData("Study Event Name", "Form Name, "TIMEPOINT");

Note that this method will return ALL collected instances of matching form data, including nonconformant and canceled data. To account for this be sure to filter the returned data accordingly.

...

Code Block
{
    "itemDataId": 223,
    "itemGroupDataId": 22,
    "formDataId": 9,
    "siteName": 12,
    "investigatorName": 'Dr. Johnson',
    "investigatorId": 19
}

Here’s an example of accessing this context data, parsing it in Javascript and working with data:

Code Block
var itemDataContext = JSON.parse(getItemDataContext());
logger(itemDataContext);
var itemDataId = itemDataContext.itemDataId;
logger('itemDataId '+itemDataContext.itemDataId);
logger('investigatorId '+itemDataContext.investigatorId);
logger('investigatorName '+itemDataContext.investigatorName);

return itemDataId;

Note that this is standard in 22.3, but can be made available to older ClinSpark environments with a support ticket.

...

Code Block
logger('Some debug value '+value);

...