/
Find Item Value From Same Study Event
© 2025 IQVIA - All Rights Reserved
Find Item Value From Same Study Event
Summary
This method retrieves a value from another collected form in the same study event. It filters the forms returned to find only Complete data.
Formal Expression
// set the name of the item which contains the desired value
var DATE_OF_VISIT_ITEM_NAME = 'SV_DATE'
var studyEventName = formJson.form.studyEventName;
logger('studyEventName '+studyEventName);
var allVisitData = findFormData(studyEventName,'Date of Visit');
var completedVisitData = collectCompleted(allVisitData);
var visitDataForm = null
if (completedVisitData.length == 0) {
logger('no completedVisitData found');
} else if (completedVisitData.length == 1) {
visitDataForm = completedVisitData[0];
} else if (completedVisitData.length > 1) {
logger('multiple values of completedVisitData found. Picking the first');
visitDataForm = completedVisitData[0];
}
var value = null;
if (visitDataForm != null) {
value = findFirstItemValueByName(visitDataForm, DATE_OF_VISIT_ITEM_NAME);
}
return value;
function collectCompleted(formDataArray) {
if (formDataArray == null) { return []; }
var keepers = [];
for (var i = formDataArray.length - 1; i >= 0; i--) {
var formData = formDataArray[i];
if (formData.form.canceled == false && formData.form.itemGroups[0].canceled == false && (formData.form.dataCollectionStatus == 'Complete'
)) {
keepers.push(formData);
}
}
return keepers;
}
, multiple selections available,
Related content
Introduction to Methods
Introduction to Methods
Read with this
Sort Date Values and Return Most Recent
Sort Date Values and Return Most Recent
More like this
Populate Item Barcode(s) or Sample Transfer Barcode(s) from the same Form into a Specific Item
Populate Item Barcode(s) or Sample Transfer Barcode(s) from the same Form into a Specific Item
Read with this
Return a Unique Incremental ID Number
Return a Unique Incremental ID Number
More like this
Creating Methods and Edit Checks
Creating Methods and Edit Checks
Read with this
collectCompletedFormData
collectCompletedFormData
More like this
Exported and Printed Copies Are Uncontrolled