Let's say you have got the value of total in a variable say numTotal. You want to display it in a field named numField1. You can write a formCalc or javascript to do that. Below is an example of how to do it through formCalc script:
if (numTotal > 49) then
form1.sf1.NumField1.rawValue = 50
else
form1.sf1.NumField1.rawValue = numTotal;
endif