Complex calculation on xforms

I have 5 fields - bilirubin, INR,ascites, encephalopathy and albumin in my xform

I would like to calculate a score based on the value entered in these fields to get the total points

Whats a better way to module this in xforms

cc @dkayiwa

Here is a detailed explanation of the calculation

1 Like

I do not seem to understand this. Can we discuss on IRC?

Based on the example from

The function would be

if(/form/obs/INR/value > 2.30) {
 	return 3;
} else if (/form/obs/INR/value > 1.70 && <2.31) {
 	return 2;
} else if (/form/obs/INR/value < 1.71) {
 	return 1;

After evaluating all the ifs - then the return values would be calculated (person can have more than – and if for example between 5-6 , the field would be populated as class A

cc @dkayiwa

@dkayiwa please try using this online calculator