© 2024 IQVIA - All Rights Reserved

Out Of Range Item Data in Item Group

Summary

This method returns “Y” when the any ItemData within the specified ItemGroup is NOT canceled and is out of range.

Form Setup

This method assumes that there is an ItemGroup matching the name of ITEM_GROUP_NAME_TO_SEARCH value contained within the form to which this method is attached.

Note that this method does not consider repeat keys, and will consider only the first itemGroup found matching the name. If other behavior is required please modify the logic accordingly.

Formal Expression

Variables:

  • ITEM_GROUP_NAME_TO_SEARCH = Name of the itemGroup within the same form which should be inspected for OutOfRange itemData.

var ITEM_GROUP_NAME_TO_SEARCH = 'Blood Pressure'; var itemGroup = findFirstItemGroupByName(formJson,ITEM_GROUP_NAME_TO_SEARCH); if (!itemGroup) return "N"; if (itemGroupHasOorItem(itemGroup)) { 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