Let's say in the first row the fields are called Price1, Price2, Units1 and Total1.
Use this code as the custom calculation script of Total1:
var units = Number(this.getField("Units1").value);
if (units<=4) event.value = Number(this.getField("Price1").value) * units;
else event.value = Number(this.getField("Price2").value) * units;
SORRY FOR CAPS...BUT THANK YOU SO MUCH!!!!
One could have a column of fields names "Price4", "Price5", "Quantity",. and "Total".
The first row's names would be "Priece4.0", Price5.0", Quantity.0", and "Total.0". The next row would be the ".1" suffix and so on.
One than can use a value to indicate the row being processed and access only the fields in that row.
For the first row's total the script could be"
nRow = 0; // index for row of table.
// get the field values:
var Price4 = this.getField("Pirce4." + nRow).value;
var Price5 = this.getField("Pirce5." + nRow).value;
var Quantity = this.getField("Quantity." + nRow;).value;
// compute extended price on quantity orderd;
if(Quantity > 4) event.value = Quantity * Price5; // quantity of more than 4;
else event.value = Quantity * Price4; // quantity of 4 or less;
One now only needs to copy the code to the other totals and change the value of nRow as needed.