© 2024 IQVIA - All Rights Reserved

Out Of Range Item Data in Form

Summary

This method searches through the enclosing FormData, inspecting each ItemData within. It returns “Y” if the any ItemData NOT canceled and also is out of range.

Form Setup

None required.

Formal Expression

var itemGroups = formJson.form.itemGroups; if (itemGroups && itemGroups.length) { for (var i = 0; i < itemGroups.length; i++) { var itemGroup = itemGroups[i]; if (itemGroupHasOorItem(itemGroup)) { logger('ItemGroup '+itemGroup.name+' has an item out of range'); return "Y"; } } } return "N"; function itemGroupHasOorItem(itemGroup) { var items = itemGroup.items; var item = itemJson.item; for (var i = 0; i < items.length; i++) { if (items[i]) { item = items[i]; if (item.canceled != true && item.outOfRange == true) { logger('Item '+item.name+' is out of range'); return true; } } } return false; } /* Finds the first match of an itemGroup from the given form. Optionally uses itemGroupRepeatKey as well */ function findFirstItemGroupByName(formJson, itemGroupName, itemGroupRepeatKey) { var itemGroups = formJson.form.itemGroups; if (itemGroups && itemGroups.length) { for (var i = 0; i < itemGroups.length; i++) { var itemGroup = itemGroups[i]; if (itemGroupRepeatKey == null || itemGroupRepeatKey == itemGroup.itemGroupRepeatKey) { if (itemGroup.name == itemGroupName) { return itemGroup; } } } } return null; } }

Exported and Printed Copies Are Uncontrolled