Calculation not to exceed a certain amount
I am trying to create the following calculation.
Required number of credits- credits completed= credits needed.
What I need to have happen is for the total not to exceed the required number of credits but still show a total if the the difference is less than the required number of credits- credits completed.
I used the following equation for it not to exeed the required number of credits, but if the balance of credits needed is less than the required credits, it only shows the max number allowed.
var v1 = Number(this.getField("30").value);
var v2 = Number(this.getField("ABENGCOMP").value);
event.value = Math.max(30, v1-v2);
The highlighted section in the image below shows where the issue is. The totals on these should be 5 and 3, respectively.

Thanks in advance.
