getDataElementsArray( )
Return an array of data element arrays that contain data collection information about all existing instances for each variable.
Return
Syntax
getDataElementsArray(var1, var2, ...)
Parameters
Parameter | Required/Optional | Description |
---|---|---|
variable(s) |
Required | Item variable to retrieve. |
Return value
The rule returns an array of data element arrays that contain data collection information about all existing instances for each variable. Includes visit or branch short name.
Examples
Example 3-98 Rule with two variables: txt and num
var obj = getDataElementsArray(txt, num);
var result = "";
if(obj && obj.result)
{
//list of dataelements for txt variable
var txtPathObject = obj.result[0];
//list of dataelements for num variable
var numPathObject = obj.result[1];
//dataelement value can be referenced through index
//return txtPathObject[0].value + " --- " + numPathObject[0].value;
//dataelement value can be referenced through forEach loop
txtPathObject.forEach(function(txtVar) {
result = result + ">>>" + txtVar.value;
});
/*var result = "";
numPathObject.forEach(function(numVar) {
result = result + ">>>" + numVar.value;
});*/
}
return result;
var obj = getDataElementsArray(txt, num);
var result = "";
if(obj && obj.result)
{
//list of dataelements for txt variable
var txtPathObject = obj.result[0];
//list of dataelements for num variable
var numPathObject = obj.result[1];
//access to dataelements properties for txt variable
if(txtPathObject[0].visitShortName=='Visit1')
//do something
if(txtPathObject[0].visitType=='SCHEDULED') //visit type
//do something
if(txtPathObject[0].eventInstanceNum=='1') //cycle instance number or unscheduled visit instance number
//do something
if(txtPathObject[0].repeatSequenceNumber=='1') //repeating form instance number
//do something
if(txtPathObject[0].value=='Yes') //###user friendly value to be implemented
//do something
}
return result;
These types of JavaScript expressions can be used in Oncology Solid Tumor studies to sum up all the lesions prior to that visit and determine the lowest prior sum. Additionally, the rule can be used to check if a certain value exists in at least one visit or to compare values with the current visit, form, and so forth.
Parent topic: Multiple visit schedules and cycle visit functions