Converting weight and length units in EDC/CDMS
Table of Contents
Sometimes you need to convert the units of a given measure to keep a unified format across your study. These conversions are usually inches or feet to centimetres and pounds to kilograms, or vice-versa. In all these cases, we can use a simple operation to get it done. See some examples below:
inches to cm
var cent = {your_variable_in_inches} * 2.54;
cent.toFixed(2);
*The toFixed() method will format the output value with the amount of decimal positions specified in the parentheses. In this case, 2.
cm to inches
var inch = {your_variable_in_cm} / 2.54;
inch.toFixed(2);
feet to cm
var cent = {your_variable_in_feet} * 30.48;
cent.toFixed(2);
cm to feet
var feet = {your_variable_in_cm} / 30.48;
feet.toFixed(2);
pounds to kg
var kilog = {your_variable_in_pounds} * 0.4536;
kilog.toFixed(2);
kg to pounds
var pounds = {your_variable_in_kg} / 0.4536;
pounds.toFixed(2);