© 2024 IQVIA - All Rights Reserved
Multiply and Truncate
Equation
Multiply input by 10 and truncate the last decimal place.
For example, if input = 0.14
0.14 x 10 = 1.40
Truncate last decimal for result of 1.4
Example Form Setup
Formal Expression
var SOURCE_VALUE_ITEM_NAME = 'LB_Alcohol Test Results Day 1';
var repeatKey = itemJson.item.itemGroupRepeatKey;
var origItem = findFirstItemByName(formJson, SOURCE_VALUE_ITEM_NAME, null, repeatKey);
var origValue = origItem.value;
var origDecimalPlaces = countDecimals(origValue);
var newValue = origValue * 10;
newValue = newValue.toFixed(origDecimalPlaces - 1);
return newValue;
function countDecimals(number) {
if(Math.floor(number) === number) return 0;
return number.toString().split(".")[1].length || 0;
}
Â
Exported and Printed Copies Are Uncontrolled