Assign a score based on a percentage in EDC/CDMS
In the calculation you can give a 'score' based on the value of a different field. In the template below, the calculation field value will be 1 if variable_x is in between 1% and 19%, 2 if variable_x is in between 20% and 39%, etc:
If variable_x is... | The score is... |
In between 1% and 19% (incl. 1 and 19) | 1 |
In between 20% and 39% | 2 |
In between 40% and 59% | 3 |
In between 60% and 79% | 4 |
In between 80% and 100% | 5 |
Template:
var score = 0;
if ({variable_x} >= 1 && {variable_x} < 20) {
score = 1;
} else if ({variable_x} >= 20 && {variable_x} < 40) {
score = 2;
} else if ({variable_x} >= 40 && {variable_x} < 60) {
score = 3;
} else if ({variable_x} >= 60 && {variable_x} < 80) {
score = 4;
} else if ({variable_x} >= 80 && {variable_x} <= 100) {
score = 5;
}
score;